mirror of
https://git.openapi.site/https://github.com/desirecore/config-center.git
synced 2026-06-06 04:30:51 +08:00
fix(ci): drop npm install fallback and use explicit test file path (#4)
回应 PR #3 review 反馈: 1. 移除 'npm ci || npm install' 兜底 (Copilot review #2) lockfile 已 commit,兜底反而会掩盖未来 lockfile 不一致问题, 导致 CI 依赖解析随时间漂移。改为纯 'npm ci' 严格按 lockfile 安装。 2. test 脚本改用具体文件路径 (Copilot review #3) 原 'node --test __tests__/*.test.mjs' 依赖 shell glob 展开, 在 Windows cmd(npm 在 Windows 上的默认 script-shell)不展开 glob。 实测 'node --test __tests__'(Copilot 建议)在 Node v22 报 'Cannot find module',故改用直接列具体文件方式: 'node --test __tests__/validate.test.mjs',跨平台稳定。 未来新增测试文件需手动追加(成本极低)。 未应用的 review 评论: - README 表格语法误报:实际已用单 |,Copilot 误读 unified diff 的 + 前缀 - loadSchemas 加 try/catch:schema 文件由维护者控制,原 stack trace 已显示路径, 额外错误处理属过度防御
This commit is contained in:
2
.github/workflows/validate.yml
vendored
2
.github/workflows/validate.yml
vendored
@@ -21,7 +21,7 @@ jobs:
|
|||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci || npm install
|
run: npm ci
|
||||||
|
|
||||||
- name: Run validator
|
- name: Run validator
|
||||||
run: npm run validate
|
run: npm run validate
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"validate": "node scripts/validate.mjs",
|
"validate": "node scripts/validate.mjs",
|
||||||
"test": "node --test __tests__/*.test.mjs"
|
"test": "node --test __tests__/validate.test.mjs"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ajv": "^8.17.1",
|
"ajv": "^8.17.1",
|
||||||
|
|||||||
Reference in New Issue
Block a user