Skip to content

Commit

Permalink
fix: cypress now usable with next
Browse files Browse the repository at this point in the history
  • Loading branch information
cpaule1811 committed Sep 21, 2021
1 parent 3c6c6d6 commit 0496f4b
Show file tree
Hide file tree
Showing 15 changed files with 2,337 additions and 1,372 deletions.
2 changes: 1 addition & 1 deletion cypress.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{

"testFiles": "**/*.cy.{js,jsx,ts,tsx}",
"experimentalComponentTesting": true,
"componentFolder": "src",
"nodeVersion": "system"
}
16 changes: 13 additions & 3 deletions cypress/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,18 @@
// // `on` is used to hook into various events Cypress emits
// // `config` is the resolved Cypress config
//}
const webpackPreprocessor = require('@cypress/webpack-preprocessor')

module.exports = (on) => {
on('file:preprocessor', webpackPreprocessor())
const injectDevServer = require('@cypress/react/plugins/next')

module.exports = (on, config) => {
injectDevServer(on, config)

return config
}

module.exports = (on, config) => {
require('@cypress/react/plugins/react-scripts')(on, config)
// IMPORTANT to return the config object
// with the any changed environment variables
return config
}
2 changes: 1 addition & 1 deletion cypress/support/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
require("cypress-react-unit-test/support");

Loading

0 comments on commit 0496f4b

Please sign in to comment.