In my experience it works just fine https://github...
# component-testing
g
In my experience it works just fine https://github.com/bahmutov/sudoku-app/blob/main/cypress.config.js
Copy code
component: {
    devServer: {
      framework: 'create-react-app',
      bundler: 'webpack',
      webpackConfig: {
        ...
h
@gray-kilobyte-89541 you don't use the "verbose" version where you can run custom code though, you're just providing an object with the config, in my version it's actually a method that runs and returns the final config
just to make sure 🙂 what I mean is that I got a
devServer
method under
component
, which then runs and returns the imported
devServer
from
@cypress/webpack-dev-server
(yes, I should rename the imported package for more clarity, sorry 😅 )
w
FWIW I couldn't get it to work with this:
Copy code
import { defineConfig } from 'cypress'
import cracoConfig from './craco.config.js'
import { createWebpackDevConfig } from '@craco/craco'
//import { devServer } from '@cypress/webpack-dev-server'

const webpackConfig = createWebpackDevConfig(cracoConfig)

export default defineConfig({
  component: {
    devServer: {
      bundler: 'webpack',
      framework: 'create-react-app',
      webpackConfig,
    },
    specPattern: 'src/**/*spec.{ts,tsx}',
  },
})
got an error on launching cypress (see screenshot) but this seems to work:
Copy code
import { defineConfig } from 'cypress'
import cracoConfig from './craco.config.js'
import { createWebpackDevConfig } from '@craco/craco'
import { devServer } from '@cypress/webpack-dev-server'

const webpackConfig = createWebpackDevConfig(cracoConfig)

export default defineConfig({
  component: {
    devServer(cypressConfig) {
      return devServer(cypressConfig, { webpackConfig })
    },
    specPattern: 'src/**/*spec.{ts,tsx}',
  },
})
7 Views