Skip to content

Commit a9db53e

Browse files
committed
unify vitest config w/ projects pattern
- add root vitest.config.ts with projects config - add vitest.shared.ts for common test settings - update packages/core and packages/storage to use shared - downgrade vitest to 3.2.4 (pool-workers incompatible w/ 4.x) - add syncpack for version sync
1 parent 6bbf82b commit a9db53e

8 files changed

Lines changed: 2864 additions & 23 deletions

File tree

package.json

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@
1616
"types": "./dist/core/src/index.d.ts",
1717
"typesVersions": {
1818
"*": {
19-
".": ["./dist/core/src/index.d.ts"],
20-
"storage": ["./dist/storage/src/index.d.ts"],
21-
"alarms": ["./dist/alarms/src/index.d.ts"]
19+
".": [
20+
"./dist/core/src/index.d.ts"
21+
],
22+
"storage": [
23+
"./dist/storage/src/index.d.ts"
24+
],
25+
"alarms": [
26+
"./dist/alarms/src/index.d.ts"
27+
]
2228
}
2329
},
2430
"files": [
@@ -30,7 +36,11 @@
3036
"cf-typegen": "wrangler types",
3137
"build": "tsc -p ./packages",
3238
"dev": "vite",
33-
"clean": "rm -rf dist .wrangler worker-configuration.d.ts"
39+
"clean": "rm -rf dist .wrangler worker-configuration.d.ts",
40+
"test": "vitest",
41+
"test:run": "vitest run",
42+
"test:ui": "vitest --ui",
43+
"sync:versions": "syncpack fix-mismatches"
3444
},
3545
"engines": {
3646
"node": ">=18.0.0"
@@ -54,8 +64,13 @@
5464
},
5565
"devDependencies": {
5666
"@cloudflare/vite-plugin": "1.12.3",
67+
"@cloudflare/vitest-pool-workers": "^0.10.15",
68+
"@cloudflare/workers-types": "^4.20251213.0",
69+
"@vitest/ui": "^3.2.4",
70+
"syncpack": "^13.0.4",
5771
"typescript": "^5.5.2",
5872
"vite": "^6.3.5",
73+
"vitest": "^3.2.4",
5974
"wrangler": "^4.34.0"
6075
}
6176
}

packages/core/vitest.config.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
import { defineConfig } from "vitest/config";
1+
import { defineConfig, mergeConfig } from 'vitest/config'
2+
import { sharedConfig } from '../../vitest.shared'
23

3-
export default defineConfig({
4-
test: {},
5-
});
4+
export default mergeConfig(
5+
defineConfig(sharedConfig),
6+
defineConfig({
7+
test: {
8+
name: 'core',
9+
environment: 'node',
10+
},
11+
})
12+
)

packages/storage/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@cloudflare/workers-types": "^4.20250610.0",
1515
"typescript": "^5.5.2",
1616
"vite": "^6.3.5",
17-
"vitest": "~3.1.0",
17+
"vitest": "^3.2.4",
1818
"wrangler": "^4.16.0"
1919
}
2020
}

packages/storage/vitest.config.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/storage/vitest.config.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { defineWorkersProject } from '@cloudflare/vitest-pool-workers/config'
2+
import { sharedConfig } from '../../vitest.shared'
3+
4+
export default defineWorkersProject({
5+
test: {
6+
...sharedConfig.test,
7+
name: 'storage',
8+
poolOptions: {
9+
workers: {
10+
singleWorker: true,
11+
wrangler: {
12+
configPath: './test/test-wrangler.jsonc',
13+
},
14+
},
15+
},
16+
},
17+
})

0 commit comments

Comments
 (0)