Skip to content
Source
Sign inSign up
TanStack/schemas
Open History to see the last commit

vitest.workers.config.ts

26 lines829 Bytes

1import { cloudflareTest, readD1Migrations } from '@cloudflare/vitest-plugin'
2import { defineProject } from 'vitest/config'
3​
4const migrations = await readD1Migrations('./drizzle')
5​
6export default defineProject({
7 plugins: [
8 cloudflareTest({
9 miniflare: {
10 // Mirrors wrangler.jsonc (compatibility + bindings); kept inline
11 // because pointing the pool at wrangler.jsonc would make it load the
12 // full TanStack Start worker via `main`.
13 compatibilityDate: '2025-09-02',
14 compatibilityFlags: ['nodejs_compat'],
15 kvNamespaces: ['SCHEMA_CACHE'],
16 d1Databases: ['DB'],
17 bindings: { TEST_MIGRATIONS: migrations },
18 },
19 }),
20 ],
21 test: {
22 name: 'workers',
23 include: ['src/**/*.worker.test.ts'],
24 setupFiles: ['./src/test/apply-migrations.ts'],
25 },
26})