-
-
Notifications
You must be signed in to change notification settings - Fork 254
Expand file tree
/
Copy pathvitest.cloudflare.config.ts
More file actions
27 lines (25 loc) · 877 Bytes
/
vitest.cloudflare.config.ts
File metadata and controls
27 lines (25 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import path from 'node:path'
import { cloudflareTest, readD1Migrations } from '@cloudflare/vitest-pool-workers'
import { defineConfig } from 'vitest/config'
export default defineConfig({
plugins: [
cloudflareTest(async () => {
const migrationsPath = path.join(__dirname, './migrations')
const migrations = await readD1Migrations(migrationsPath)
return {
// D1 and vars live under [env.production] in wrangler.toml; tell the
// pool which environment to apply so env.DB resolves at test time.
wrangler: { configPath: './wrangler.toml', environment: 'production' },
miniflare: {
bindings: { TEST_MIGRATIONS: migrations },
},
}
}),
],
test: {
globals: true,
testTimeout: 15000,
include: ['server/**/*.cf-test.ts'],
setupFiles: ['./server/test/apply-migrations.ts'],
},
})