Files
zpan/vitest.cloudflare.config.ts
T
saltbo 4f9483bd1f refactor(deploy): flatten wrangler config and rename preview to staging
- Top-level config is now production (no more [env.production])
- Remove local-only D1 binding with fake database_id that broke Workers Builds
- Rename [env.preview] to [env.staging]
- Update vitest cloudflare config to use top-level instead of env.production

Dashboard config:
- Deploy command: npx wrangler deploy
- Version command: npx wrangler versions upload --env staging

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 11:39:29 -04:00

26 lines
723 B
TypeScript

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 {
wrangler: { configPath: './wrangler.toml' },
miniflare: {
bindings: { TEST_MIGRATIONS: migrations },
},
}
}),
],
test: {
globals: true,
testTimeout: 15000,
include: ['server/**/*.cf-test.ts', 'workers/**/*.cf-test.ts'],
setupFiles: ['./server/test/apply-migrations.ts'],
},
})