forked from du2333/flare-stack-blog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
56 lines (54 loc) · 1.58 KB
/
Copy pathvitest.config.ts
File metadata and controls
56 lines (54 loc) · 1.58 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import path from "node:path";
import {
defineWorkersConfig,
readD1Migrations,
} from "@cloudflare/vitest-pool-workers/config";
import viteTsConfigPaths from "vite-tsconfig-paths";
import { loadEnv } from "vite";
export default defineWorkersConfig(async () => {
const migrationsPath = path.join(__dirname, "migrations");
const migrations = await readD1Migrations(migrationsPath);
return {
plugins: [
viteTsConfigPaths({
projects: ["./tsconfig.json"],
}),
],
resolve: {
alias: {
"@tanstack/react-start/server-entry": path.join(
__dirname,
"./tests/mocks/tanstack-start-mock.ts",
),
},
},
test: {
env: loadEnv("test", process.cwd(), "VITE_"),
setupFiles: ["./tests/apply-migrations.ts"],
poolOptions: {
workers: {
singleWorker: true,
wrangler: {
configPath: "./wrangler.jsonc",
environment: "test",
},
miniflare: {
bindings: {
TEST_MIGRATIONS: migrations,
BETTER_AUTH_SECRET:
"a-very-long-test-secret-that-is-at-least-32-chars-long",
BETTER_AUTH_URL: "http://localhost:3000",
ADMIN_EMAIL: "admin@example.com",
GITHUB_CLIENT_ID: "test-id",
GITHUB_CLIENT_SECRET: "test-secret",
CLOUDFLARE_ZONE_ID: "test-zone",
CLOUDFLARE_PURGE_API_TOKEN: "test-token",
DOMAIN: "example.com",
ENVIRONMENT: "test",
},
},
},
},
},
};
});