Skip to content

Commit 1184e77

Browse files
committed
refactor(test): 迁移测试框架从Jest到Vitest并重构测试配置
feat(test): 添加测试脚本和配置管理工具 style(test): 统一测试文件格式和导入方式 test: 更新单元测试和集成测试用例 chore: 移除Jest相关依赖和配置文件
1 parent 0cab028 commit 1184e77

50 files changed

Lines changed: 3743 additions & 2819 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vscode/extensions.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
2-
"recommendations": [
3-
"biomejs.biome",
4-
"bradlc.vscode-tailwindcss",
5-
"ms-vscode.vscode-typescript-next"
2+
"recommendations": ["biomejs.biome", "bradlc.vscode-tailwindcss"],
3+
"unwantedRecommendations": [
4+
"esbenp.prettier-vscode",
5+
"dbaeumer.vscode-eslint",
6+
"rvest.vs-code-prettier-eslint"
67
]
7-
}
8+
}

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"source.organizeImports.biome": "explicit"
77
},
88
"eslint.enable": false,
9+
"prettier.enable": false,
910
"typescript.preferences.includePackageJsonAutoImports": "on",
1011
"typescript.suggest.autoImports": true,
1112
"files.associations": {

biome.json

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
},
88
"formatter": {
99
"enabled": true,
10+
"formatWithErrors": true,
1011
"indentStyle": "space",
1112
"indentWidth": 2,
1213
"lineWidth": 88
@@ -87,16 +88,22 @@
8788
"semicolons": "always",
8889
"trailingCommas": "es5"
8990
},
90-
"globals": ["jest", "describe", "test", "it", "expect", "beforeEach", "afterEach", "beforeAll", "afterAll", "global"]
91+
"globals": [
92+
"jest",
93+
"describe",
94+
"test",
95+
"it",
96+
"expect",
97+
"beforeEach",
98+
"afterEach",
99+
"beforeAll",
100+
"afterAll",
101+
"global"
102+
]
91103
},
92104
"overrides": [
93105
{
94-
"includes": [
95-
"tests/**/*",
96-
"**/*.test.ts",
97-
"**/*.spec.ts",
98-
"src/**/*test*"
99-
],
106+
"includes": ["tests/**/*", "**/*.test.ts", "**/*.spec.ts", "src/**/*test*"],
100107
"linter": {
101108
"rules": {
102109
"suspicious": {

package.json

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,38 @@
1717
"dev": "bun --watch src/blade.tsx",
1818
"build": "rm -rf dist && bun build src/blade.tsx --external react-devtools-core --external react --external react-dom --external ink --external ink-* --external yargs --external chalk --external inquirer --minify --outfile dist/blade.js --target=node",
1919
"start": "bun run dist/blade.js",
20-
"test": "vitest",
21-
"test:watch": "vitest --watch",
22-
"test:coverage": "vitest --coverage",
23-
"test:unit": "vitest --testNamePattern=\"(unit|__tests__)\"",
24-
"test:integration": "vitest --testNamePattern=\"integration\"",
25-
"test:e2e": "vitest --testNamePattern=\"e2e\"",
26-
"test:ci": "vitest run --coverage",
20+
"test": "node scripts/test.js",
21+
"test:all": "vitest run --config vitest.config.ts",
22+
"test:unit": "node scripts/test.js unit",
23+
"test:integration": "node scripts/test.js integration",
24+
"test:e2e": "node scripts/test.js e2e",
25+
"test:security": "node scripts/test.js security",
26+
"test:coverage": "node scripts/test.js all --coverage",
27+
"test:unit:coverage": "node scripts/test.js unit --coverage",
28+
"test:integration:coverage": "node scripts/test.js integration --coverage",
29+
"test:watch": "vitest --watch --config vitest.config.ts",
30+
"test:unit:watch": "vitest --watch --config vitest.workspace.ts --project unit",
31+
"test:integration:watch": "vitest --watch --config vitest.workspace.ts --project integration",
32+
"test:debug": "node scripts/test.js all --debug",
33+
"test:verbose": "node scripts/test.js all --verbose",
34+
"test:ci": "vitest run --config vitest.config.ts --coverage --reporter=verbose",
2735
"test:performance": "vitest --testNamePattern=\"performance\" --verbose",
28-
"test:debug": "vitest --no-cache --verbose",
2936
"lint": "biome lint src tests",
3037
"lint:fix": "biome lint --write src tests",
3138
"format": "biome format --write src tests",
3239
"format:check": "biome format src tests",
3340
"check": "biome check src tests",
3441
"check:fix": "biome check --write src tests",
3542
"type-check": "tsc --noEmit",
36-
"check:full": "npm run type-check && npm run lint && npm run format:check && npm run test",
43+
"check:full": "npm run type-check && npm run lint && npm run format:check && npm run test:ci",
3744
"security:audit": "pnpm audit",
3845
"security:test": "bash scripts/run-security-tests.sh",
3946
"release": "node scripts/release.js",
4047
"release:dry": "node scripts/release.js --dry-run",
4148
"release:major": "node scripts/release.js --major",
4249
"release:minor": "node scripts/release.js --minor",
4350
"release:patch": "node scripts/release.js --patch",
44-
"clean": "rm -rf dist node_modules/.cache",
51+
"clean": "rm -rf dist node_modules/.cache coverage",
4552
"prepare": "bun run build",
4653
"preflight": "npm run clean && pnpm install && npm run format && npm run lint && npm run build && npm run type-check && npm run test:ci"
4754
},
@@ -88,6 +95,7 @@
8895
"@types/ws": "^8.5.12",
8996
"@types/yargs": "^17.0.33",
9097
"@vitest/coverage-v8": "^3.0.0",
98+
"execa": "^9.6.0",
9199
"jsdom": "^26.0.0",
92100
"ts-node": "^10.9.2",
93101
"typescript": "^5.9.2",

0 commit comments

Comments
 (0)