-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
42 lines (40 loc) · 1.37 KB
/
Copy pathvitest.config.ts
File metadata and controls
42 lines (40 loc) · 1.37 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { defineConfig } from "vitest/config";
import {
cloudflareTest,
readD1Migrations,
} from "@cloudflare/vitest-pool-workers";
// Read once at config time and handed to the test Worker as a binding, so a
// suite can rebuild the schema without touching the filesystem. The path is
// relative to the project root, which is vitest's working directory — keeping
// this file free of node: imports so it typechecks with Workers types alone.
const migrations = await readD1Migrations("migrations");
export default defineConfig({
plugins: [
cloudflareTest({
main: "./src/index.ts",
miniflare: {
compatibilityDate: "2025-04-01",
compatibilityFlags: ["nodejs_compat"],
d1Databases: ["DB"],
bindings: {
TEST_MIGRATIONS: migrations,
ADMIN_PASSWORD: "correct-horse-battery-staple",
// base64 of 32 deterministic bytes — test-only, never a real key.
ENCRYPTION_KEY: "AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE=",
SESSION_SECRET: "test-session-secret-do-not-use-in-production",
GRAPH_API_VERSION: "v25.0",
RETENTION_DAYS: "0",
},
},
}),
],
test: {
globals: true,
setupFiles: ["./tests/apply-migrations.ts"],
coverage: {
provider: "istanbul",
include: ["src/**/*.ts"],
exclude: ["src/ui/**", "src/types.ts"],
},
},
});