Release God's Eye View as open source

This commit is contained in:
Bilawal Sidhu committed 2026-08-24 17:02:16 -05:00
1 parent a5aaea7e16
commit 880a672b5e
433 files changed
+219893 -23

No files matched your search

+67
View File
@@ -0,0 +1,67 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import {
ALLOCATION_TEST_FILES,
allocationTestArgs,
assertNode24AllocationRuntime,
buildUnitTestPlan,
isCalibratedAllocationRuntime,
} from '../scripts/run-unit-tests.mjs';
test('unit runner serializes only GC-bracketed allocation microbenchmarks', () => {
const ordinary = [
'src/data/manager.test.mjs',
'src/data/radio.test.mjs',
'src/unitTestRunner.test.mjs',
];
const plan = buildUnitTestPlan([
ordinary[1],
ALLOCATION_TEST_FILES[1],
ordinary[0],
ALLOCATION_TEST_FILES[0],
ordinary[2],
]);
assert.deepEqual(plan.parallel, ordinary);
assert.deepEqual(plan.serializedAllocations, ALLOCATION_TEST_FILES);
assert.equal(plan.parallel.some((file) => ALLOCATION_TEST_FILES.includes(file)), false);
for (const file of ALLOCATION_TEST_FILES) {
assert.deepEqual(allocationTestArgs(file), [
'--expose-gc', '--test', '--test-concurrency=1', file,
]);
}
assert.throws(
() => allocationTestArgs('src/data/radio.test.mjs'),
/Not an allocation microbenchmark/,
);
});
test('allocation runtime calibration is explicit and pinned to Node 24', () => {
assert.equal(assertNode24AllocationRuntime('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/,
);
assert.equal(isCalibratedAllocationRuntime('24.19.0'), true);
assert.equal(isCalibratedAllocationRuntime('22.23.1'), false);
assert.equal(isCalibratedAllocationRuntime('26.3.0'), false);
});
test('npm test stays green on every supported engine, not only the calibrated one', () => {
// 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.
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/);
});