fix: require runtime evidence in budget gate

This commit is contained in:
2026-09-02 09:00:58 +03:00
parent e3ac3a4db4
commit e8b15a4e6e
8 changed files with 81 additions and 8 deletions

View File

@@ -0,0 +1,35 @@
#!/usr/bin/env node
import { spawn } from 'node:child_process';
import { access } from 'node:fs/promises';
import { resolve } from 'node:path';
const repositoryRoot = process.cwd();
const tracePath = resolve(repositoryRoot, 'test-results/runtime-budget-trace.v1.json');
const runNode = (args) => new Promise((resolveRun, rejectRun) => {
const child = spawn(process.execPath, args, {
cwd: repositoryRoot,
env: process.env,
stdio: 'inherit',
});
child.once('error', rejectRun);
child.once('exit', (code, signal) => {
if (code === 0) resolveRun();
else rejectRun(new Error(`Command failed${signal === null ? ` with exit code ${code}` : ` from signal ${signal}`}.`));
});
});
await runNode([
resolve(repositoryRoot, 'node_modules/@playwright/test/cli.js'),
'test',
'tests/performance/runtime-budget-trace.spec.ts',
'--project=runtime-budget-desktop',
'--workers=1',
]);
await access(tracePath);
await runNode([
resolve(repositoryRoot, 'scripts/check-bundle-budgets.mjs'),
'dist',
'--runtime-trace',
tracePath,
]);