@@ -6,55 +6,25 @@ export default defineConfig({
66 env : {
77 codeCoverage : {
88 exclude : [ 'cypress/**/*.*' , '**/__tests__/**/*.*' , '**/*.test.*' ] ,
9- reportDir : 'coverage/cypress' ,
10- all : true ,
11- include : [ 'src/**/*.ts' , 'src/**/*.tsx' ] ,
12- reporter : [ 'text' , 'html' , 'text-summary' , 'json' , 'lcov' ] ,
13- tempDir : 'coverage/.nyc_output' ,
149 } ,
1510 } ,
1611 watchForFileChanges : false ,
1712 component : {
1813 // src/components/editor/__tests__/blocks/Paragraph.cy.tsx
19- specPattern : '**/*.cy.tsx' ,
14+ specPattern : 'src/**/__tests__/ **/*.cy.tsx' ,
2015 devServer : {
2116 framework : 'react' ,
2217 bundler : 'vite' ,
2318 } ,
24- setupNodeEvents ( on , config ) {
25- codeCoverageTask ( on , config ) ;
26-
27- // 在测试完成后生成报告
28- on ( 'after:run' , async ( ) => {
29- try {
30- // 确保目录存在
31- execSync ( 'mkdir -p coverage/cypress' ) ;
32- // 运行 nyc 报告
33- execSync ( 'nyc report --reporter=lcov --reporter=text --reporter=html --report-dir=coverage/cypress' , {
34- stdio : 'inherit'
35- } ) ;
36- } catch ( error ) {
37- console . error ( 'Error generating coverage report:' , error ) ;
38- }
39- } ) ;
40-
41- on ( 'task' , {
42- log ( message ) {
43- console . log ( message ) ;
44- return null ;
45- } ,
46- table ( message ) {
47- console . table ( message ) ;
48- return null ;
49- }
50- } ) ;
51- return config ;
52- } ,
5319 supportFile : 'cypress/support/component.ts' ,
5420 } ,
55- e2e : {
56- specPattern : '**/*.cy.ts' ,
57- supportFile : 'cypress/support/e2e.ts' ,
58- baseUrl : 'http://localhost:3000/' ,
21+ chromeWebSecurity : false ,
22+ retries : {
23+ // Configure retry attempts for `cypress run`
24+ // Default is 0
25+ runMode : 10 ,
26+ // Configure retry attempts for `cypress open`
27+ // Default is 0
28+ openMode : 0 ,
5929 } ,
6030} ) ;
0 commit comments