-
Notifications
You must be signed in to change notification settings - Fork 27
/
cypress.config.cjs
67 lines (60 loc) · 1.92 KB
/
cypress.config.cjs
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
const { defineConfig } = require('cypress')
const vitePreprocessor = require('cypress-vite')
const path = require('path')
module.exports = defineConfig({
video: false,
defaultCommandTimeout: 10000,
execTimeout: 60000,
taskTimeout: 60000,
pageLoadTimeout: 60000,
requestTimeout: 30000,
responseTimeout: 30000,
fixturesFolder: 'tests/e2e/fixtures',
screenshotsFolder: 'tests/e2e/screenshots',
videosFolder: 'tests/e2e/videos',
e2e: {
baseUrl: 'http://localhost:5173',
setupNodeEvents (on, config) {
// For test coverage
require('@cypress/code-coverage/task')(on, config)
/* By default, Cypress uses webpack to transform spec files before
running them. But it makes more sense to use vite instead, using the
same config as the project.
Note: Set NODE_ENV to prevent vite eslint plugin linting errors failing
the transform (e.g. no-only-tests rule) */
process.env.NODE_ENV = 'development'
on(
'file:preprocessor',
vitePreprocessor({
configFile: path.resolve(__dirname, './vite.config.js'),
mode: 'development',
})
)
return Object.assign({}, config, {
fixturesFolder: 'tests/e2e/fixtures',
specPattern: 'tests/e2e/specs',
screenshotsFolder: 'tests/e2e/screenshots',
videosFolder: 'tests/e2e/videos',
supportFile: 'tests/e2e/support/index.js'
})
},
specPattern: 'tests/e2e/specs/**/*.cy.{js,jsx,ts,tsx}',
supportFile: 'tests/e2e/support/index.js'
},
component: {
devServer: {
framework: 'vue',
bundler: 'vite'
},
setupNodeEvents (on, config) {
// For test coverage
require('@cypress/code-coverage/task')(on, config)
return config
},
},
env: {
// eslint-disable-next-line no-unneeded-ternary
coverage: process.env.COVERAGE ? true : false
},
morgan: false, // Disable XHR logging as it's very noisy
})