Skip to content

Commit e50861e

Browse files
committed
fix(tests): make classifier benchmark assertion portable
Treat the wall-clock winner as benchmark output instead of requiring v5 to win across every operating system and Node runtime. Keep stable coverage for classifier parity, version inventory, checksums, positive timings, and minimum selection.\n\nValidated with Node 22.20.0 targeted repetition, the full 833-test suite, package verification, and git diff checks.
1 parent 15d3201 commit e50861e

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

test/dependency-governance.test.mjs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ test("dependency governance CLI emits JSON for direct agent use", async () => {
116116
}
117117
});
118118

119-
test("five classifier versions agree and the fifth version wins the bundled benchmark", () => {
119+
test("five classifier versions agree and the benchmark reports observed timings", () => {
120120
const paths = generateSyntheticDependencyPaths({ packageCount: 400, fillerCount: 8000 });
121121
const baseline = classifyPathsWithVersion(paths, "v5");
122122

@@ -126,6 +126,16 @@ test("five classifier versions agree and the fifth version wins the bundled benc
126126
}
127127

128128
const benchmark = benchmarkClassifierVersions({ paths, iterations: 80 });
129-
assert.equal(benchmark.best.version, "v5");
129+
// Wall-clock rankings vary with the OS, Node/JIT version, architecture, and runner load.
130+
// Treat the measured winner as benchmark output rather than a cross-platform test contract.
131+
assert.deepEqual(
132+
benchmark.versions.map((item) => item.version).sort(),
133+
["v1", "v2", "v3", "v4", "v5"],
134+
);
130135
assert.ok(benchmark.versions.every((item) => item.elapsedMs > 0));
136+
assert.ok(benchmark.versions.every((item) => item.checksum === benchmark.best.checksum));
137+
assert.equal(
138+
benchmark.best.elapsedMs,
139+
Math.min(...benchmark.versions.map((item) => item.elapsedMs)),
140+
);
131141
});

0 commit comments

Comments
 (0)