Skip to content

Commit b090bd4

Browse files
committed
feat(tests): 添加 Vitest 测试工具支持,更新 README 文档以说明测试用法
1 parent 7d4dce1 commit b090bd4

4 files changed

Lines changed: 584 additions & 6 deletions

File tree

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,20 @@
2222
4. `generate-types``build` 脚本分别用于生成类型文件,Maps,打包代码。
2323
5. 按照项目规范开发并构建发布。
2424

25+
**测试说明:**
26+
27+
- 本仓库已集成 [vitest](https://vitest.dev/) 作为单元测试工具,推荐在实现模块功能后为其编写测试用例。
28+
- 常用测试相关 script:
29+
- `pnpm test`:运行所有测试用例。
30+
- `pnpm test-pkg-axios`:仅测试 packages/axios 包。
31+
- `pnpm coverage`:生成测试覆盖率报告。
32+
2533
## 依赖与开发
2634

2735
- 包管理工具:pnpm
2836
- 代码规范:ESLint、Prettier、Commitlint
2937
- 构建工具:Rolldown、tsc
38+
- 测试工具:Vitest
3039
- 其他依赖详见 package.json
3140

3241
## 贡献

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
"scripts": {
77
"intro": "npx tsx index.ts",
88
"prepare": "husky",
9+
"test": "vitest",
10+
"test-pkg-axios": "vitest packages/axios",
11+
"coverage": "vitest run --coverage",
912
"generate-types": "pnpm -r --filter @ethan-utils/* run generate-types",
1013
"build:only": "pnpm -r --filter @ethan-utils/* run build",
1114
"build": "run-s generate-types build:only",
@@ -36,10 +39,11 @@
3639
"rolldown": "1.0.0-beta.20",
3740
"tsx": "^4.20.3",
3841
"typescript": "^5.8.3",
39-
"typescript-eslint": "^8.35.0"
42+
"typescript-eslint": "^8.35.0",
43+
"vitest": "^3.2.4",
44+
"commitizen": "^4.3.1"
4045
},
4146
"dependencies": {
42-
"chalk": "^5.4.1",
43-
"commitizen": "^4.3.1"
47+
"chalk": "^5.4.1"
4448
}
4549
}

0 commit comments

Comments
 (0)