-
Notifications
You must be signed in to change notification settings - Fork 842
/
cypress.config.ts
53 lines (48 loc) · 1.36 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
import { defineConfig } from 'cypress';
import { unlinkSync } from 'fs';
import webpackConfig from './cypress/webpack.config';
export default defineConfig({
retries: {
runMode: 2,
openMode: 2,
},
component: {
devServer: {
framework: 'react',
bundler: 'webpack',
webpackConfig,
},
setupNodeEvents(on, config) {
require('@cypress/code-coverage/task')(on, config);
on('file:preprocessor', require('@cypress/code-coverage/use-babelrc'));
on('task', {
log(message) {
console.log(message);
return null;
},
table(message) {
console.table(message);
return null;
},
});
on(
'after:spec',
(spec: Cypress.Spec, results: CypressCommandLine.RunResult) => {
if (config.video) {
if (results.stats.failures !== 0) {
console.log(
`[FAILURE]: Recording video for ${results.spec.name}.`
);
} else {
unlinkSync(results.video!);
}
}
}
);
return config;
},
specPattern: ['./src/**/*.spec.tsx', './src/**/*.a11y.tsx'], // scripts/cypress.js splits this using the CLI --spec argument
video: false,
videoCompression: 32, // more time to process, but a smaller file to upload as an artifact
},
});