-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathvitest.config.ts
More file actions
63 lines (60 loc) · 1.64 KB
/
vitest.config.ts
File metadata and controls
63 lines (60 loc) · 1.64 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
import { defineConfig } from 'vitest/config';
import path from 'path';
import { fileURLToPath } from 'url';
// Get __dirname equivalent in ESM
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default defineConfig({
test: {
globals: true,
environment: 'happy-dom',
setupFiles: ['./test-setup.ts'],
env: {
TZ: 'UTC', // Force UTC timezone for consistent date handling across all tests
},
coverage: {
provider: 'istanbul',
reporter: ['lcov', 'text'],
reportsDirectory: './coverage',
// Only include files that are imported by tests (similar to Bun's behavior)
// But exclude test files themselves
exclude: [
'**/*.test.{ts,tsx}',
'**/*.spec.{ts,tsx}',
'__tests__/**',
'__mocks__/**',
'test-setup.ts',
'scripts/**',
'drizzle/**',
'*.config.*',
'coverage/**',
'.next/**',
'node_modules/**',
'instrumentation.ts',
// Exclude Next.js app files that aren't tested
'app/**/layout.tsx',
'app/**/page.tsx',
'app/**/error.tsx',
'app/**/not-found.tsx',
'app/**/global-error.tsx',
'app/providers.tsx',
],
},
// Enable parallel execution (this is what we want!)
pool: 'threads',
// Isolate tests in separate contexts
isolate: true,
},
resolve: {
alias: [
{
find: /^@\/(.*)$/,
replacement: path.resolve(__dirname, './$1'),
},
],
},
// Externalize Bun built-in modules so they're not bundled by Vite
ssr: {
noExternal: true,
},
});