test(reports): support Node 22 module mocks
Independent Staging Quality Gate / validate (push) Has been cancelled
Independent Staging Quality Gate / publish (push) Has been cancelled

This commit is contained in:
Jesse_Chen
2026-09-04 04:58:16 +08:00
parent 71f63f8a84
commit 8950b77746
2 changed files with 28 additions and 16 deletions
+16
View File
@@ -7919,3 +7919,19 @@
- 相关记录:BUG-511、BUG-512
- 复发自:无
- 修复版本:待发布
## BUG-514 | 专业报告导出测试使用 Node 24 模块 mock 选项,Node 22 发布门加载为空模块
- 状态:resolved
- 首次发现:2026-09-03
- 最近更新:2026-09-04
- 影响面:`frontend/tests/professional-report-reference-route.test.ts``Independent Staging Quality Gate`
- 用户现象:staging quality gate Run 2362 的前端测试 `2627 pass / 1 fail`;专业报告导出路由测试报 `does not provide an export named 'ACCOUNT_BIRTH_SELECT'`,镜像发布被跳过。
- 触发条件:Gitea 的 Node 22 执行新增的 `mock.module(..., { exports: ... })` 测试;本地 Node 24 会通过。
- 根因:Node 22 的实验性模块 mock 使用 `namedExports`;未知的 `exports` 选项被忽略,生成不含命名导出的 mock 模块。本地只在 Node 24 验证,未覆盖发布门运行时。
- 修复:改用 Node 22/24 均支持的 `namedExports`,按路由实际别名注册 mock;删除共享出生资料 helper 的 mock,改用真实 helper 和虚构数据库行。
- 验证:Node 22.14 与 Node 24.15 分别运行 `tsx --test tests/professional-report-reference-route.test.ts`,均为 4/4 通过;Node 22.14 全量前端测试 2628/2628 通过,TypeScript 0 错。
- 防复发:使用实验性 Node API 的发布门测试必须在仓库门禁主版本 Node 22 至少跑一次;模块 mock 不得使用仅新版本接受的选项名。
- 相关记录:无
- 复发自:无
- 修复版本:待发布