vfs.unit.test.ts's 'Performance > should handle many files efficiently' (100 writes + readdir, 5.5s write budget) is a wall-clock flake: 121ms alone, 16.5s under the gate's sibling-file contention — the code never caused it. Same pattern already used for storage-batch-operations.test.ts's batch-vs-individual timing case: ctx.skip(!process.env.BRAINY_PERF_LANE, reason) inside the test, and the file added to vitest.perf.config.ts's include list (it stays in the unit gate's *.unit.test.ts match too, so every other test in the file keeps running there).
75 lines
3 KiB
TypeScript
75 lines
3 KiB
TypeScript
import { defineConfig } from 'vitest/config'
|
|
|
|
/**
|
|
* Perf/scale + environment-dependent test configuration.
|
|
*
|
|
* The exclusive on-demand slot for everything the correctness gate
|
|
* (`vitest.config.ts`, the config a bare `vitest run` picks up) excludes:
|
|
* wall-clock/scale benchmarks and the two tests whose outcome depends on
|
|
* the host machine or network rather than the code. See CONTRIBUTING.md's
|
|
* "Test gate" section and the exclude list in `vitest.config.ts` (root) for
|
|
* why each file lives here instead of the gate.
|
|
*
|
|
* `include` names this set explicitly — it is the mirror image of the
|
|
* root config's exclude list, not an independent glob, so the two stay in
|
|
* sync by inspection. Longer timeouts than the gate's 120s/60s: one case in
|
|
* tests/critical-performance-benchmark.test.ts measures ~128s of real work.
|
|
*/
|
|
export default defineConfig({
|
|
test: {
|
|
globals: true,
|
|
setupFiles: ['./tests/setup.ts'],
|
|
environment: 'node',
|
|
|
|
// The marker a test uses to tell it is running under this lane (see
|
|
// tests/integration/storage-batch-operations.test.ts's batch-vs-
|
|
// individual timing case) — a wall-clock RATIO assertion self-skips
|
|
// with a reason when this is absent, rather than flaking the
|
|
// correctness gate on whichever path happens to be faster this build.
|
|
env: { BRAINY_PERF_LANE: '1' },
|
|
|
|
// Sequential, single fork — same isolation the gate uses, so a perf
|
|
// measurement isn't skewed by sibling test contention.
|
|
pool: 'forks',
|
|
poolOptions: {
|
|
forks: {
|
|
maxForks: 1,
|
|
minForks: 1,
|
|
singleFork: true,
|
|
isolate: true
|
|
}
|
|
},
|
|
|
|
testTimeout: 300000, // 5 minutes per test (the 128s case plus headroom)
|
|
hookTimeout: 120000,
|
|
teardownTimeout: 10000,
|
|
|
|
maxConcurrency: 1,
|
|
fileParallelism: false,
|
|
|
|
include: [
|
|
'tests/performance/**/*.{test,spec}.{js,ts}',
|
|
'tests/critical-performance-benchmark.test.ts',
|
|
'tests/api/performance-benchmarks.test.ts',
|
|
'tests/package-size-limit.test.ts',
|
|
'tests/model-loading.test.ts',
|
|
// Not a whole perf file — one wall-clock-ratio case inside an
|
|
// otherwise-correctness integration suite (self-skipped everywhere
|
|
// else via BRAINY_PERF_LANE). Stays in the integration gate's
|
|
// include too, so every OTHER test in the file keeps running there.
|
|
'tests/integration/storage-batch-operations.test.ts',
|
|
// Same pattern: one wall-clock budget case (100-file write + readdir,
|
|
// 5.5s budget) inside an otherwise-correctness VFS unit suite
|
|
// (self-skipped everywhere else via BRAINY_PERF_LANE — see
|
|
// tests/vfs/vfs.unit.test.ts's 'Performance > should handle many
|
|
// files efficiently'). Stays in the unit gate's *.unit.test.ts match
|
|
// too, so every OTHER test in the file keeps running there.
|
|
'tests/vfs/vfs.unit.test.ts'
|
|
],
|
|
|
|
reporters: process.env.CI ? ['dot'] : ['basic'],
|
|
|
|
retry: process.env.CI ? 1 : 0,
|
|
shard: process.env.VITEST_SHARD
|
|
}
|
|
})
|