-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathcypress.config.ts
55 lines (43 loc) · 1.35 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { defineConfig } from 'cypress';
import urlJoin from 'url-join';
import loadEnvConfig from './devtools/env';
import webpackConfig from './devtools/webpack/cypress';
const setupEnvironment = () => {
if (!process.env.NODE_ENV) {
process.env.NODE_ENV = 'test';
}
// setup the environment
loadEnvConfig(__dirname, true, true);
};
const baseUrl = process.env.CYPRESS_BASE_URL || 'http://localhost:3000';
export default defineConfig({
e2e: {
// this can always be override with environment variable
baseUrl,
env: {
codeCoverage: {
url: urlJoin(baseUrl, '/__coverage__'),
},
},
setupNodeEvents(on, config) {
setupEnvironment();
// eslint-disable-next-line global-require
require('@cypress/code-coverage/task')(on, config);
// eslint-disable-next-line global-require
require('./cypress/plugins').default(on, config);
return config;
},
},
component: {
devServer: {
framework: 'react',
bundler: 'webpack',
webpackConfig,
},
setupNodeEvents(on, config) {
// eslint-disable-next-line global-require
require('@cypress/code-coverage/task')(on, config);
return config;
},
},
});