-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
49 lines (44 loc) · 1.3 KB
/
vitest.config.ts
File metadata and controls
49 lines (44 loc) · 1.3 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
import { defineWorkersConfig } from '@cloudflare/vitest-pool-workers/config';
import { readFileSync, existsSync } from 'fs';
import { platform } from 'os';
const isWindows = platform() === 'win32';
if (isWindows) {
console.warn(
'\n⚠️ Skipping e2e tests on Windows (SQLite/workerd incompatibility)\n' +
' These tests run in CI on Linux.\n'
);
}
function getFiaAccessKey(): string {
if (process.env.FIA_ACCESS_KEY) return process.env.FIA_ACCESS_KEY;
if (existsSync('.dev.vars')) {
const content = readFileSync('.dev.vars', 'utf-8');
const match = content.match(/^FIA_ACCESS_KEY=(.+)$/m);
if (match) {
process.env.FIA_ACCESS_KEY = match[1];
return match[1];
}
}
return '';
}
const fiaAccessKey = getFiaAccessKey();
export default defineWorkersConfig({
test: {
globals: true,
poolOptions: {
workers: {
wrangler: { configPath: './wrangler.toml' },
miniflare: {
bindings: {
ENVIRONMENT: 'test',
FIA_API_URL: 'https://api.fiaproject.org/graphql',
FIA_AUTH_URL: 'https://auth.fiaproject.org/token',
FIA_ACCESS_KEY: fiaAccessKey,
},
},
},
},
include: ['tests/**/*.test.ts'],
exclude: isWindows ? ['tests/e2e/**'] : [],
testTimeout: 30000,
},
});