-
Notifications
You must be signed in to change notification settings - Fork 347
Expand file tree
/
Copy pathvitest.shared.ts
More file actions
37 lines (35 loc) · 1.12 KB
/
vitest.shared.ts
File metadata and controls
37 lines (35 loc) · 1.12 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
import * as path from 'node:path';
import { defineConfig } from 'vitest/config';
// Absolute path to the root test-setup — used as setupFiles so every package
// gets connection-pool cleanup without needing a per-package file.
const rootTestSetup = (dirname: string) => path.resolve(dirname, '../../test/test-setup.ts');
export const getSharedVitestConfig = ({
__dirname: dirname,
}: {
__dirname: string;
}) => {
return defineConfig({
resolve: {
alias: {
'@': path.resolve(dirname, 'src'),
},
},
test: {
setupFiles: [rootTestSetup(dirname)],
env: {
// Always point at local Docker — never production, regardless of .env
DATABASE_URL: 'postgresql://postgres:postgres@localhost:5432/postgres?schema=public',
CLICKHOUSE_URL: 'http://localhost:8123/openpanel',
REDIS_URL: 'redis://localhost:6379',
SELF_HOSTED: 'true',
},
include: ['**/*.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
browser: {
name: 'chromium',
provider: 'playwright',
headless: true,
},
fakeTimers: { toFake: undefined },
},
});
};