chore(gates): DEC-N6 让 e2e 进类型口径,并修 pre-commit 位与证据路径覆盖历史

- 新增 e2e/tsconfig.json + `npm run type-check:e2e`(并入 test:all)。
  本轮实测证据:teardown 补丁里第二个 `const revalidateSecret` 与既有声明重名,
  `npm run type-check` 全程 EXIT=0,只有 `playwright test --list` 才报重复声明 ——
  现在静态期就能抓。读数:type-check:e2e EXIT=0。
- .husky/pre-commit 的索引模式改回 100755(本轮每次提交都在打
  "was ignored because it's not set as executable",即 lint-staged 在任何克隆里都不执行)。
  验证看 `git ls-files -s .husky` 的 mode,不是看文件系统权限。
- axe 证据落盘改为按运行轮次分目录(原写死 docs/acceptance/2026-09-21-axe/axe-evidence.json,
  于是每跑一次就覆盖一次历史:0157b1c9 里那 409 行 diff 就是这么产生的),
  并补 check:axe:selftest;判定逻辑与退出码三档语义未动。
- 顺带修一处仪器级缺陷:package.json 里 `type-check:e2e` 被写了两遍 ——
  JSON 重复键是后者静默覆盖前者,不会报错也不会判红,正是本仓反复吃的"重复声明"类。
  现取键数与值由 node 回读校验。
This commit is contained in:
zhangxiang committed 2026-10-17 07:54:21 +08:00
1 parent 2e0099426f
commit 1c0ce5f458
12 files changed
+199 -27

No files matched your search

+17
View File
@@ -41,6 +41,11 @@ export default defineConfig({
animations: 'disabled',
caret: 'hide',
scale: 'device',
// @ts-expect-error 类型口径缺口(不是运行时缺口):@playwright/test 的
// expect.toHaveScreenshot 选项类型里没有 `timeout`,但实现确实读它 ——
// node_modules/playwright/lib/matchers/expect.js:12182 `helper.options.timeout ?? this.timeout`。
// 删掉这行会让截图断言超时从 20s 回落到下面的 expect.timeout=15000,属行为变更 ⇒ 保留并标记。
// 若日后 Playwright 把 timeout 补进类型,本指令会因「未使用」而报错,届时直接摘掉标记。
timeout: 20000,
},
timeout: 15000,
@@ -54,6 +59,14 @@ export default defineConfig({
// 视觉回归确定性:reducedMotion 让 ScrollReveal/StaggerReveal 走 initial={} 分支
// 默认可见(不残留 opacity:0),避免全页截图时 below-the-fold 模块因 whileInView
// 未触发而空白。同时使 Hero 粒子场走固定种子的静态降级帧,快照零漂移。
//
// ⚠ 残留 R-1(DEC-N6 补口带出,本批未修,需视觉 owner 拍板):这条意图**当前并没有生效**。
// `reducedMotion` 是 browser.newContext() 的上下文选项,不是 `use` 层选项:
// node_modules/playwright/lib/index.js:241-266 的 fixture 白名单里没有它,
// `_combinedContextOptions` 只从 `contextOptions` 取值 ⇒ 写在 use 里被直接忽略。
// 生效写法是 `contextOptions: { reducedMotion: 'reduce' }`,但那会真的关掉动效、
// 改变截图字节 ⇒ 与正在重采的 132 张基线冲突,本批只标注不改行为。
// @ts-expect-error 残留 R-1:见上,use 层无 reducedMotion 选项
reducedMotion: 'reduce',
},
testMatch: 'visual-regression.spec.ts',
@@ -63,6 +76,7 @@ export default defineConfig({
use: {
...devices['iPad Pro 11'],
viewport: { width: 834, height: 1194 },
// @ts-expect-error 残留 R-1:use 层无 reducedMotion 选项,运行时被忽略(见 visual-chromium-desktop 处说明)
reducedMotion: 'reduce',
},
testMatch: 'visual-regression.spec.ts',
@@ -74,6 +88,7 @@ export default defineConfig({
viewport: { width: 390, height: 844 },
isMobile: true,
hasTouch: true,
// @ts-expect-error 残留 R-1:use 层无 reducedMotion 选项,运行时被忽略(见 visual-chromium-desktop 处说明)
reducedMotion: 'reduce',
},
testMatch: 'visual-regression.spec.ts',
@@ -84,6 +99,7 @@ export default defineConfig({
...devices['Desktop Firefox'],
viewport: { width: 1280, height: 800 },
storageState: './storageState.firefox.json',
// @ts-expect-error 残留 R-1:use 层无 reducedMotion 选项,运行时被忽略(见 visual-chromium-desktop 处说明)
reducedMotion: 'reduce',
},
testMatch: 'visual-regression.spec.ts',
@@ -94,6 +110,7 @@ export default defineConfig({
...devices['Desktop Safari'],
viewport: { width: 1280, height: 800 },
storageState: './storageState.firefox.json',
// @ts-expect-error 残留 R-1:use 层无 reducedMotion 选项,运行时被忽略(见 visual-chromium-desktop 处说明)
reducedMotion: 'reduce',
},
testMatch: 'visual-regression.spec.ts',