test(e2e,unit): add navigation edge cases and component coverage

- Add missing-paths E2E spec for desktop/mobile navigation and contrast
- Add local Playwright config for dev server testing
- Expand unit tests for CMS data server, products, contact and UI components
- Adjust jest config for new test patterns
This commit is contained in:
张翔
2026-07-08 14:47:07 +08:00
parent 7f36211342
commit a6ea2cc72c
11 changed files with 1693 additions and 34 deletions
+61 -17
View File
@@ -17,32 +17,76 @@ module.exports = {
'!src/**/*.stories.{ts,tsx}',
'!src/**/__tests__/**',
],
// 覆盖率阈值采用渐进提升策略:初始值设低于当前实测值,每完成一个迭代任务后提升
// 当前实测值: global(~17% stmts/~12% branches), hooks(~18%/~5%), lib(~33%/~10%), ui(~16%/~21%)
// 覆盖率阈值采用渐进提升策略:基于 Phase 1-5 实测值设定目录级阈值,避免全局平均掩盖核心模块缺口
// 实测基准 (Phase 5): global(~33% stmts/~32% branches), hooks(~61%/~41%), lib(~45%/~43%),
// ui(~15%/~21%), layout(~59%/~48%), detail(~32%/~29%), sections(~31%/~35%), content(~29%/~5%),
// lib/cms(~67%/~83%), lib/constants(~94%/~81%)
coverageThreshold: {
global: {
branches: 10,
branches: 30,
functions: 25,
lines: 32,
statements: 30,
},
'./src/hooks/': {
branches: 38,
functions: 60,
lines: 60,
statements: 60,
},
'./src/lib/': {
branches: 40,
functions: 45,
lines: 42,
statements: 42,
},
'./src/components/ui/': {
branches: 18,
functions: 10,
lines: 15,
statements: 14,
},
'./src/hooks/': {
branches: 3,
functions: 15,
lines: 15,
statements: 14,
'./src/components/layout/': {
branches: 45,
functions: 35,
lines: 60,
statements: 55,
},
'./src/lib/': {
branches: 8,
'./src/components/detail/': {
branches: 25,
functions: 22,
lines: 30,
statements: 30,
},
'./src/components/sections/': {
branches: 30,
functions: 18,
lines: 28,
statements: 28,
lines: 30,
statements: 30,
},
'./src/components/ui/': {
branches: 16,
functions: 9,
lines: 14,
statements: 13,
'./src/components/content/': {
branches: 4,
functions: 4,
lines: 25,
statements: 25,
},
'./src/components/seo/': {
branches: 0,
functions: 20,
lines: 45,
statements: 45,
},
'./src/lib/cms/': {
branches: 80,
functions: 75,
lines: 60,
statements: 65,
},
'./src/lib/constants/': {
branches: 80,
functions: 55,
lines: 90,
statements: 90,
},
},
coverageReporters: ['text', 'lcov', 'html', 'json'],