Skip to content
File

Blob: vitest.config.ts

typescript50 lines
1import { cloudflareTest } from "@cloudflare/vitest-pool-workers";
2import { resolve } from "node:path";
3import { defineConfig } from "vitest/config";
4 
5const TEST_ENCRYPTION_KEY = Buffer.alloc(32, 7).toString("base64");
6const VITEST_POOL_COMPATIBILITY_FLAGS = [
7 "enable_nodejs_tty_module",
8 "enable_nodejs_fs_module",
9 "enable_nodejs_http_modules",
10 "enable_nodejs_perf_hooks_module",
11 "enable_nodejs_v8_module",
12 "enable_nodejs_process_v2",
13];
14 
15export default defineConfig({
16 plugins: [
17 cloudflareTest({
18 main: "./src/worker/index.ts",
19 wrangler: {
20 configPath: "./wrangler.jsonc",
21 },
22 miniflare: {
23 assets: {
24 directory: "./tests/assets",
25 },
26 compatibilityFlags: VITEST_POOL_COMPATIBILITY_FLAGS,
27 bindings: {
28 APP_ENCRYPTION_KEY_CURRENT_VERSION: "1",
29 APP_ENCRYPTION_KEYS_JSON: JSON.stringify({
30 1: TEST_ENCRYPTION_KEY,
31 }),
32 TESSERA_OIDC_ISSUER: "https://tessera.test",
33 TESSERA_OIDC_CLIENT_ID: "anvil-test",
34 TESSERA_OIDC_CLIENT_SECRET: "anvil-test-secret",
35 },
36 },
37 }),
38 ],
39 resolve: {
40 alias: {
41 "@": resolve(__dirname, "src"),
42 },
43 },
44 test: {
45 fileParallelism: false,
46 include: ["tests/**/*.test.ts"],
47 exclude: ["tests/integration/**/*.test.ts"],
48 },
49});