Skip to content

Commit 4ab5645

Browse files
committed
test: no coverage when cypress
1 parent 10af771 commit 4ab5645

File tree

2 files changed

+14
-41
lines changed

2 files changed

+14
-41
lines changed

.github/workflows/e2e.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,11 @@ jobs:
3838
start: pnpm run start
3939
browser: chrome
4040

41-
- name: Run Component Tests with Coverage
42-
run: pnpm test:components:parallel
41+
- name: Run Component Tests
42+
run: |
43+
echo "Starting component tests..."
44+
pnpm test:components:parallel
45+
echo "Component tests finished."
4346
4447
- name: Upload coverage to Codecov
4548
uses: codecov/codecov-action@v3

cypress.config.ts

Lines changed: 9 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)