fix(ci): run allocation gates on Node 26

This commit is contained in:
BreezeDelegate committed 2026-10-25 03:15:11 +01:00
1 parent 2dca762e4a
commit bbfb23a765
8 files changed
+46 -48

No files matched your search

+10 -13
View File
@@ -7,7 +7,7 @@ import {
ALLOCATION_TEST_FILES,
UNIT_TEST_ROOTS,
allocationTestArgs,
assertNode24AllocationRuntime,
assertCalibratedAllocationRuntime,
buildUnitTestPlan,
discoverUnitTestFiles,
isCalibratedAllocationRuntime,
@@ -87,30 +87,27 @@ test('the runner discovers every test file in the repository', () => {
}
});
test('allocation runtime calibration is explicit and pinned to Node 24', () => {
assert.equal(assertNode24AllocationRuntime('24.19.0'), '24.19.0');
test('allocation runtime calibration covers both supported Node majors', () => {
assert.equal(assertCalibratedAllocationRuntime('24.19.0'), '24.19.0');
assert.throws(
() => assertNode24AllocationRuntime('22.23.1'),
/calibrated Node 24 runtime/,
);
assert.throws(
() => assertNode24AllocationRuntime('26.0.0'),
/calibrated Node 24 runtime/,
() => assertCalibratedAllocationRuntime('22.23.1'),
/calibrated Node 24 or 26/,
);
assert.equal(assertCalibratedAllocationRuntime('26.0.0'), '26.0.0');
assert.equal(isCalibratedAllocationRuntime('24.19.0'), true);
assert.equal(isCalibratedAllocationRuntime('22.23.1'), false);
assert.equal(isCalibratedAllocationRuntime('26.3.0'), false);
assert.equal(isCalibratedAllocationRuntime('26.3.0'), true);
});
test('npm test stays green on every supported engine, not only the calibrated one', () => {
test('npm test calibrates both supported engines while retaining off-range warnings', () => {
// package.json wiring: `npm test` must invoke this runner, and the engines
// range it advertises must not be narrower than what the runner tolerates.
const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
assert.equal(pkg.scripts.test, 'node scripts/run-unit-tests.mjs');
const enginesNode = String(pkg.engines?.node || '');
assert.ok(enginesNode, 'engines.node must be declared');
// The runner throws for uncalibrated runtimes ONLY behind the explicit
// opt-in env; by default it skips, so a supported non-24 engine cannot fail.
// Unsupported runtimes only skip probes without the explicit opt-in hard gate.
// Node 26 is calibrated and runs those probes with the same budgets.
const runner = readFileSync(new URL('../scripts/run-unit-tests.mjs', import.meta.url), 'utf8');
assert.match(runner, /GEV_REQUIRE_ALLOCATION_GATE/);
assert.match(runner, /SKIPPED .*allocation microbenchmarks/);