mirror of
https://github.com/saltbo/zpan.git
synced 2026-08-29 00:01:42 +08:00
35 lines
923 B
TypeScript
35 lines
923 B
TypeScript
import path from 'node:path'
|
|
import { cloudflareTest, readD1Migrations } from '@cloudflare/vitest-pool-workers'
|
|
import { defineConfig } from 'vitest/config'
|
|
|
|
const aliases = {
|
|
'@': path.resolve(__dirname, './src'),
|
|
'@shared': path.resolve(__dirname, './shared'),
|
|
'@server': path.resolve(__dirname, './server'),
|
|
}
|
|
|
|
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 },
|
|
},
|
|
}
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: aliases,
|
|
},
|
|
test: {
|
|
globals: true,
|
|
testTimeout: 15000,
|
|
include: ['server/**/*.cf-test.ts', 'workers/**/*.cf-test.ts'],
|
|
setupFiles: ['./server/test/apply-migrations.ts'],
|
|
},
|
|
})
|