test(qa): e2e 装配修正 + 集成/门禁测试与工具链重构

- e2e:修死选择器与蜜罐误命中、补断言、GA4/security-headers 用例诚实标注
  skip 边界;新增 assert-helpers/fixtures/hydrated/primary-nav/touch-targets
  等复用桩。
- 集成层:config/test/jest.integration.config.js + tests-integration/ 真库
  一次性 SQLite 用例,teardown 守卫开发库指纹。
- 门禁工具链:jest.setup 归位到根、scripts/accessibility 全站 axe 节点计数、
  check-brand-text-token/check-motion-constraints 机械守卫、stryker/lighthouse
  配置收敛。
This commit is contained in:
2026-09-28 10:48:08 +08:00
parent a366bd1400
commit 6bb7c557ee
142 changed files with 6597 additions and 2653 deletions
@@ -0,0 +1,48 @@
// @ts-nocheck
/**
* src/generated/prisma/** 的专用 Jest transformer。
*
* Prisma 6 的 `prisma-client` generator 产出的是 ESM,`client.ts:16` 使用
* `fileURLToPath(import.meta.url)` 求 `__dirname`。Jest 的 CJS 运行时无法直接求值
* `import.meta`(TS 在 module=commonjs 下报 TS1343,Node 报语法错误)。
*
* 处理方式:在转译前把 `import.meta.url` 等价替换为 `require('url').pathToFileURL(__filename).href`
* —— 语义完全相同(当前模块文件的 file: URL),且不改动仓库里的生成产物。
* 仅对生成目录生效,src 下其余文件仍走 ts-jest(保留类型检查)。
*/
const ts = require('typescript');
const IMPORT_META_URL = /import\.meta\.url/g;
module.exports = {
getCacheKey(sourceText, sourcePath) {
return String(require('crypto')
.createHash('md5')
.update(sourceText)
.update('\0')
.update(String(sourcePath))
.update('\0')
.update('prisma-generated-transformer-v1'));
},
process(sourceText, sourcePath) {
const patched = sourceText.includes('import.meta.url')
? sourceText.replace(IMPORT_META_URL, "require('url').pathToFileURL(__filename).href")
: sourceText;
const out = ts.transpileModule(patched, {
fileName: String(sourcePath),
reportDiagnostics: false,
compilerOptions: {
module: ts.ModuleKind.CommonJS,
target: ts.ScriptTarget.ES2020,
esModuleInterop: true,
allowJs: true,
isolatedModules: true,
importNotAsAccessibleInCjs: undefined,
},
});
return { code: out.outputText };
},
};