Modernizes testing infrastructure with dedicated Cloudflare Workers test pool: - Replaces Nuxt Test Utils with @cloudflare/vitest-pool-workers - Adds structured test organization for API endpoints - Introduces comprehensive testing patterns and examples - Implements schema-based test data generation with zod-mock - Enhances test utilities with proper CF Workers environment The new testing setup provides better isolation, more realistic worker runtime environment, and improved test data management through structured schemas and generators.
21 lines
497 B
TypeScript
21 lines
497 B
TypeScript
import { defineWorkersConfig } from '@cloudflare/vitest-pool-workers/config'
|
|
import { loadEnv } from 'vite'
|
|
|
|
export default defineWorkersConfig(({ mode }) => ({
|
|
test: {
|
|
env: loadEnv(mode, process.cwd(), ''),
|
|
globalSetup: './tests/setup.ts',
|
|
poolOptions: {
|
|
workers: {
|
|
singleWorker: true,
|
|
isolatedStorage: false,
|
|
wrangler: {
|
|
configPath: './wrangler.jsonc',
|
|
},
|
|
miniflare: {
|
|
cf: true,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}))
|