-
Notifications
You must be signed in to change notification settings - Fork 3.3k
/
Copy pathcypress.config.ts
39 lines (32 loc) · 1.28 KB
/
cypress.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { defineConfig } from 'cypress'
export default defineConfig({
'video': true,
'projectId': 'jq5xpp',
'component': {
'testFiles': '**/*.spec.{js,ts,jsx,tsx}',
'componentFolder': 'src',
setupNodeEvents (on, config) {
const findReactScriptsWebpackConfig = require('@cypress/react/plugins/react-scripts/findReactScriptsWebpackConfig')
const { startDevServer } = require('@cypress/webpack-dev-server')
const _ = require('lodash')
const map = _.map([4, 8], (n) => n * 2)
console.log(map)
require('@cypress/code-coverage/task')(on, config)
const webpackConfig = findReactScriptsWebpackConfig(config)
const rules = webpackConfig.module.rules.find((rule) => !!rule.oneOf).oneOf
const babelRule = rules.find((rule) => typeof rule.loader === 'string' && /babel-loader/.test(rule.loader))
typeof babelRule.options !== 'string' && babelRule.options.plugins.push(require.resolve('babel-plugin-istanbul'))
on('dev-server:start', (options) => {
return startDevServer({ options, webpackConfig })
})
// IMPORTANT to return the config object
// with the any changed environment variables
return config
},
},
'env': {
'cypress-react-selector': {
'root': '#__cy_root',
},
},
})