## [ERR-20260429-002] 直接 npx ts-node 跑 testing/scripts/contract-check.ts 报 TS5107

**日期**: 2026-04-29
**类别**: 测试脚本调用方式

### 现象

```
npx ts-node --transpile-only testing/scripts/contract-check.ts
# TS5107: Option 'moduleResolution=node10' is deprecated ... Specify '"ignoreDeprecations": "6.0"'
```

换用 `./backend/node_modules/.bin/ts-node` + 命令行 `--compiler-options '{"ignoreDeprecations":"6.0"}'` 也报 `TS5103: Invalid value`（旧版 ts-node 不识别该 option）。

### 根因

contract-check 脚本依赖 `testing/tsconfig.json`（含 `ignoreDeprecations: "6.0"`）和 `testing/node_modules/ts-node`。直接命令行调用绕过了 tsconfig，且 `backend/node_modules/ts-node` 版本太旧不支持该 option。

### 正确做法

走 testing 包自带的 npm script：
```bash
cd testing && npm install     # 首次/新 worktree
npm run test:contract                          # 全量
npm run test:contract:module -- site-attendance   # 模块化
```

`testing/package.json` 的 script 显式用 `node_modules/.bin/ts-node`，自动加载 `testing/tsconfig.json`。

### 关联

- CLAUDE.md 写的 `npx ts-node --transpile-only testing/scripts/contract-check.ts` 在新 worktree / 新机器上不一定能跑通，建议改为 `cd testing && npm run test:contract`。

---
