mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-11-29 23:37:41 +00:00
Some checks failed
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Gitleaks / gitleaks (push) Waiting to run
Publish / ci (push) Blocked by required conditions
Publish / Publish to npm (push) Blocked by required conditions
Publish / Classify release event (push) Waiting to run
Publish / RC guard (marker + release-PR skip) (push) Blocked by required conditions
Publish / Build & Push RC Docker images (push) Blocked by required conditions
Scorecard / Scorecard analysis (push) Waiting to run
Trivy Image Scan / Trivy (gitnexus-cli) (push) Waiting to run
Trivy Image Scan / Trivy (gitnexus-web) (push) Waiting to run
Devcontainer Smoke / Build devcontainer image (default) (push) Has been cancelled
Devcontainer Smoke / Build devcontainer image (ui) (push) Has been cancelled
Devcontainer Smoke / Host importer tests (windows-latest) (push) Has been cancelled
Devcontainer Smoke / Config-transform unit tests (push) Has been cancelled
Devcontainer Smoke / Host importer tests (macos-latest) (push) Has been cancelled
Publish Development Images / publish (core) (push) Has been cancelled
Publish Development Images / publish (ui) (push) Has been cancelled
51 lines
1.9 KiB
TypeScript
51 lines
1.9 KiB
TypeScript
import { expect, it } from 'vitest';
|
|
import { mkdtemp, readFile, rm } from 'node:fs/promises';
|
|
import { tmpdir } from 'node:os';
|
|
import path from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
import { spawnSync } from 'node:child_process';
|
|
|
|
it('measures matching phases consecutively while alternating the first arm', async () => {
|
|
const root = await mkdtemp(path.join(tmpdir(), 'parse-cache-pairing-'));
|
|
try {
|
|
const output = path.join(root, 'measure.json');
|
|
const dist = fileURLToPath(new URL('../../dist', import.meta.url));
|
|
const result = spawnSync(
|
|
process.execPath,
|
|
[
|
|
fileURLToPath(new URL('../../bench/file-result-reuse/benchmark.js', import.meta.url)),
|
|
'--baseline-dist',
|
|
dist,
|
|
'--dist',
|
|
dist,
|
|
'--pairs',
|
|
'2',
|
|
'--files',
|
|
'2',
|
|
'--workers',
|
|
'1',
|
|
'--output',
|
|
output,
|
|
],
|
|
{ encoding: 'utf8', timeout: 90_000 },
|
|
);
|
|
expect(result.status, result.stderr || result.error?.message || result.stdout).toBe(0);
|
|
const report = JSON.parse(await readFile(output, 'utf8'));
|
|
expect(report.verdict).toBe('smoke-only');
|
|
const phases = ['cold', 'warm', 'edit', 'two-edits', 'repack'];
|
|
for (const [i, pair] of [report.warmup, ...report.pairs].entries()) {
|
|
const order = i % 2 ? ['candidate', 'baseline'] : ['baseline', 'candidate'];
|
|
expect(pair.phaseOrder).toEqual(
|
|
phases.flatMap((phase) => order.map((variant) => ({ phase, variant }))),
|
|
);
|
|
for (const variant of order) {
|
|
expect(pair[variant].measurements.map((row: { kind: string }) => row.kind)).toEqual(phases);
|
|
expect(pair[variant].measurements.map((row: { reparsed: number }) => row.reparsed)).toEqual(
|
|
[2, 0, 1, 2, 0],
|
|
);
|
|
}
|
|
}
|
|
} finally {
|
|
await rm(root, { recursive: true, force: true });
|
|
}
|
|
}, 120_000);
|