mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-11 03:38:07 +00:00
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { execFileSync } from 'node:child_process';
|
|
import { globSync, readFileSync } from 'node:fs';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
const root = fileURLToPath(new URL('../', import.meta.url));
|
|
// Discover the opt-in suites from source so a new benchmark cannot silently
|
|
// miss a hand-maintained workflow list. Keep wall-clock measurements serial.
|
|
const files = globSync('test/**/*.test.ts', { cwd: root })
|
|
.filter((file) =>
|
|
/process\.env(?:\.GITNEXUS_BENCH|\[['"]GITNEXUS_BENCH['"]\])/.test(
|
|
readFileSync(new URL(`../${file.replaceAll('\\', '/')}`, import.meta.url), 'utf8'),
|
|
),
|
|
)
|
|
.sort();
|
|
if (!files.length) throw new Error('No benchmark test suites discovered');
|
|
execFileSync(
|
|
process.execPath,
|
|
[
|
|
fileURLToPath(new URL('../node_modules/vitest/vitest.mjs', import.meta.url)),
|
|
'run',
|
|
'--no-file-parallelism',
|
|
...files,
|
|
'--reporter=default',
|
|
'--reporter=./scripts/execution-reporter.ts',
|
|
'--outputFile=benchmarks.json',
|
|
],
|
|
{
|
|
cwd: root,
|
|
stdio: 'inherit',
|
|
env: { ...process.env, GITNEXUS_BENCH: '1' },
|
|
},
|
|
);
|