File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ pnpm dev
1717
1818## 贡献与本地质量关
1919- 初次进入 ` starter ` 仓库时,务必运行 ` pnpm install ` ,该命令会安装依赖、触发 Husky ` prepare ` 钩子,并把 pre-commit/pre-push 挂载到本地仓库。
20- - 每次 ` git commit ` 前 ` pnpm lint ` 会自动运行,` git push ` 前 Husky 会再跑一次 ` pnpm test ` (` vitest ` 已固定使用 ` --runInBand ` 模式减少并发与资源抢占 )。如果遇到钩子报错,先确认 ` pnpm install ` 已完成并使用与 ` pnpm-lock.yaml ` 兼容的 Node/Pnpm 版本。
20+ - 每次 ` git commit ` 前 ` pnpm lint ` 会自动运行,` git push ` 前 Husky 会再跑一次 ` pnpm test ` (` vitest ` 在配置中设置为单线程运行,避免多线程竞争 )。如果遇到钩子报错,先确认 ` pnpm install ` 已完成并使用与 ` pnpm-lock.yaml ` 兼容的 Node/Pnpm 版本。
2121- 后端质量门控也在 GitHub Actions 中复刻:` push ` /` pull_request ` (main)触发 ` pnpm install && pnpm lint && pnpm test ` ,即便本地钩子未执行,CI 也能阻止未 lint/未测的提交合并。
2222
2323## 目录说明
Original file line number Diff line number Diff line change 4040## 4. 建议的下一步
4141- [x] 在 CI 中跑 ` pnpm lint && pnpm test ` (已完)。
4242- [x] 补充文档/钩子提示(已完)。
43- - [x] 为 ` pnpm test ` 增加 ` --runInBand ` (已完,脚本已更新到 ` package.json ` )。
43+ - [x] 为 ` pnpm test ` 通过配置禁用 ` threads ` (已完,` vitest.config.ts ` 设置为 ` threads: false ` )。
Original file line number Diff line number Diff line change 99 "lint" : " biome lint ." ,
1010 "format" : " biome format . --write" ,
1111 "typecheck" : " tsc --noEmit" ,
12- "test" : " vitest run --runInBand " ,
12+ "test" : " vitest run" ,
1313 "test:watch" : " vitest" ,
1414 "prepare" : " husky install"
1515 },
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import react from "@vitejs/plugin-react";
44export default defineConfig ( {
55 plugins : [ react ( ) ] ,
66 test : {
7+ threads : false ,
78 environment : "jsdom" ,
89 globals : true ,
910 setupFiles : [ "./vitest.setup.ts" ] ,
You can’t perform that action at this time.
0 commit comments