@@ -28,28 +28,17 @@ npm install --save-dev cypress-svelte-unit-test
2828npx install --save-dev cypress
2929```
3030
31- 1 . Tell Cypress to use your ` rollup .config.js` to bundle specs using [ cypress/plugins/index.js] ( cypress/plugins/index.js ) :
31+ 1 . Tell Cypress to use your webpack .config.js` to bundle specs using [ cypress/plugins/index.js] ( cypress/plugins/index.js ) :
3232
3333``` js
34- module .exports = (on ) => {
35- // @bahmutov/cy-rollup is already a dependency of cypress-svelte-unit-test
36- const filePreprocessor = require (' @bahmutov/cy-rollup' )
37- on (' file:preprocessor' , filePreprocessor ())
38- }
39- ```
40-
41- 2 . ⚠️ Turn the experimental component support on in your ` cypress.json ` . You can also specify where component spec files are located. For example, to have them located in ` src ` folder use:
34+ const { startDevServer } = require (' @cypress/webpack-dev-server' )
35+ const webpackConfig = require (' ../../webpack.config.js' )
4236
43- ``` json
44- {
45- "experimentalComponentTesting" : true ,
46- "componentFolder" : " src" ,
47- "testFiles" : " **/*spec.js"
37+ module .exports = (on , config ) => {
38+ on (' dev-server:start' , (options ) => startDevServer ({ options, webpackConfig }))
4839}
4940```
5041
51- See [ cypress.json] ( cypress.json ) in this project.
52-
53423 . Write a test!
5443
5544``` js
@@ -109,10 +98,13 @@ import '@cypress/code-coverage/support'
10998Add the plugin to your [ cypress/plugins/index.js] ( cypress/plugins/index.js ) file
11099
111100``` js
101+ const { startDevServer } = require (' @cypress/webpack-dev-server' )
102+ const webpackConfig = require (' ../../webpack.config.js' )
103+
112104module .exports = (on , config ) => {
113- const filePreprocessor = require (' @bahmutov/cy-rollup' )
114- on (' file:preprocessor' , filePreprocessor ())
105+ on (' dev-server:start' , (options ) => startDevServer ({ options, webpackConfig }))
115106
107+ // https://github.com/cypress-io/code-coverage
116108 require (' @cypress/code-coverage/task' )(on, config)
117109 // IMPORTANT to return the config object
118110 // with the any changed environment variables
0 commit comments