Created
May 26, 2022 06:35
-
-
Save Cerberus/f0dcae6899788969ec1c4304b9a904d8 to your computer and use it in GitHub Desktop.
Use Component Testing (cypress) with CRACO + ESBuild loader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// craco.config.js | |
const CracoEsbuildPlugin = require('craco-esbuild') | |
const { ProvidePlugin } = require('webpack') | |
module.exports = { | |
webpack: { | |
plugins: { | |
add: [new ProvidePlugin({ React: 'react' })], | |
}, | |
}, | |
plugins: [{ plugin: CracoEsbuildPlugin }], | |
} | |
// cypress/plugins/index.js | |
process.env.NODE_ENV = 'development' | |
const cracoConfig = require('../../craco.config.js') | |
const devServer = require('@cypress/react/plugins/craco') | |
module.exports = (on, config) => { | |
devServer(on, config, cracoConfig) | |
return config | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment