-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Expand file tree
/
Copy pathvitest.config.ts
More file actions
37 lines (35 loc) · 1.66 KB
/
Copy pathvitest.config.ts
File metadata and controls
37 lines (35 loc) · 1.66 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 { resolve } from 'node:path';
import { defineConfig } from 'vitest/config';
import { composeCoverageConfig } from './scripts/coverage-config';
const coveragePolicy = composeCoverageConfig(import.meta.dirname);
const coverageShard = process.env['VITEST_COVERAGE_SHARD'];
export default defineConfig({
test: {
projects: ['packages/**/vitest.config.ts'],
// Cap fork concurrency on CI so the PGlite-WASM-heavy package suites
// (cli, sql runtime, postgres/supabase extensions, postgres adapter +
// driver) don't all peak at once. Uncapped, vitest runs ~one fork per
// core; several CPU-hungry PGlite forks plus the postgres service
// container then oversubscribe the runner, stalling a fork's event loop
// long enough to drop its postgres socket ("Client ... is not
// queryable"). 50% leaves cores for the container and orchestrator.
maxWorkers: process.env['CI'] ? '50%' : undefined,
// Hard-suppress telemetry across every package test suite. The CLI's
// `program.hook('preAction', …)` would otherwise fork the sender
// child every time a test invokes the CLI in-process.
// `PRISMA_NEXT_DISABLE_TELEMETRY=1` is the documented opt-out the CLI
// honours in production; reusing it in test env keeps a single source
// of truth instead of adding a test-only env var.
env: {
PRISMA_NEXT_DISABLE_TELEMETRY: '1',
},
coverage: {
provider: 'v8',
reportsDirectory: resolve(import.meta.dirname, 'coverage'),
reporter: coverageShard ? [] : ['text', 'json'],
reportOnFailure: true,
...coveragePolicy,
thresholds: coverageShard ? {} : coveragePolicy.thresholds,
},
},
});