-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvitest.e2e.config.ts
More file actions
82 lines (71 loc) · 1.89 KB
/
vitest.e2e.config.ts
File metadata and controls
82 lines (71 loc) · 1.89 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import { playwright } from "@vitest/browser-playwright";
import { resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { defineConfig } from "vitest/config";
const rootDir = fileURLToPath(new URL(".", import.meta.url));
const srcDir = resolve(rootDir, "src");
const headless = process.env.HEADERS === "true";
/**
* Unified E2E Test Configuration for SQLite3 WASM
*
* This configuration supports:
* - OPFS E2E tests in src/jswasm/vfs/opfs/
* - Browser E2E tests in tests/browser/
* - Required headers for OPFS and SharedArrayBuffer functionality
*/
export default defineConfig({
test: {
// Include both OPFS and browser E2E tests
include: [
// "src/jswasm/vfs/opfs/*.e2e-test.ts",
"**/*.e2e.test.ts",
// "src/**/*.test.ts",
],
// Setup file for E2E tests
setupFiles: ["./vitest.e2e.setup.ts"],
// Browser testing configuration
browser: {
enabled: true,
instances: [
{
browser: "chromium",
},
],
provider: playwright(),
headless,
},
// Test timeout for E2E tests
testTimeout: 1000 * 60 * 3,
// Reporters
reporters: ["default"],
},
// Server configuration for OPFS/SAB support
server: {
headers: {
// Required for SharedArrayBuffer and OPFS functionality
"Cross-Origin-Opener-Policy": "same-origin",
"Cross-Origin-Embedder-Policy": "require-corp",
"Access-Control-Allow-Origin": "*",
"Cache-Control": "no-cache, no-store, must-revalidate",
},
},
// Build configuration for test dependencies
build: {
target: "esnext",
minify: false,
},
resolve: {
alias: {
"@": srcDir,
"web-sqlite-js": resolve(srcDir, "main.ts"),
},
},
/* Optimize dependencies */
optimizeDeps: {
exclude: ["web-sqlite-js"],
},
// Worker configuration for OPFS proxy tests
worker: {
format: "es",
},
});