Skip to content

Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.

test(core): cover test registration through a local module chain [C7]

Corey Olson7238a06338dd
diff --git a/test/cpu-load-test-fixture.js b/test/cpu-load-test-fixture.js
index fd8f1da1..2a0eb8c0 100644
--- a/test/cpu-load-test-fixture.js
+++ b/test/cpu-load-test-fixture.js
@@ -9,7 +9,7 @@ import { HOST, installSshStandIn } from './runner-ssh-fixture.js';
const SOURCE = resolve(import.meta.dirname, '..');
/** Build an ordinary CLI fixture whose declared test reports its actual checkout and live holder. */
-export function cpuLoadFixture(e2e, { declaration = '{ cpuLoad: true }', binding = 'test', subtest = null, commonjs = false, dynamicImport = false, importBinding = null, moduleSpecifier = 'node:test', importedOptions = false } = {}) {
+export function cpuLoadFixture(e2e, { declaration = '{ cpuLoad: true }', binding = 'test', subtest = null, commonjs = false, dynamicImport = false, importBinding = null, moduleSpecifier = 'node:test', importedOptions = false, registrationHelper = false } = {}) {
const probeFile = `cpu-probe.test.${commonjs ? 'cjs' : 'js'}`;
const box = e2e.project(`node bin/run-tests.js test/${probeFile}`);
const bin = join(box.dir, 'ssh-bin');
@@ -20,6 +20,10 @@ export function cpuLoadFixture(e2e, { declaration = '{ cpuLoad: true }', binding
cpSync(join(SOURCE, 'src'), join(box.repo, 'src'), { recursive: true });
cpSync(join(SOURCE, 'bin'), join(box.repo, 'bin'), { recursive: true });
writeFileSync(join(box.repo, 'package.json'), JSON.stringify({ name: 'pullboard', version: '1.0.0', type: 'module' }) + '\n');
+ if (registrationHelper) {
+ writeFileSync(join(box.repo, 'test', 'registrations.js'), "export { test as launch, after } from 'node:test';\n");
+ writeFileSync(join(box.repo, 'test', 'registration-barrel.js'), "export { launch, after } from './registrations.js';\n");
+ }
if (importedOptions) writeFileSync(join(box.repo, 'test', 'options.js'), 'export const options = { cpuLoad: true };\n');
writeFileSync(join(box.repo, 'test', probeFile), `${commonjs
? `const { test: ${binding}, after: finish } = require('node:test');\nconst { DatabaseSync } = require('node:sqlite');`
diff --git a/test/cpu-load-tests.test.js b/test/cpu-load-tests.test.js
index b7468880..2b58a792 100644
--- a/test/cpu-load-tests.test.js
+++ b/test/cpu-load-tests.test.js
@@ -203,3 +203,17 @@ for (const [kind, importBinding, moduleSpecifier] of [
assert.equal(remote.executor?.runnerExecution, true);
assert.notEqual(remote.executor?.cwd, box.repo);
});
+
+
+// Test-first module-closure control: a local barrel is executable registration, not textual metadata.
+test('a registration re-export chain with imported opaque options uses its runner [C7]', async () => {
+ const box = cpuLoadFixture(e2e, { registrationHelper: true, importedOptions: true,
+ binding: 'register', importBinding: 'launch as register', moduleSpecifier: './registration-barrel.js',
+ declaration: 'options' });
+ const remote = await box.runGate();
+ assert.equal(remote.result.status, 0, remote.result.context);
+ assert.equal(box.requestsMade().length, 1, 'a local re-export closure cannot hide registration with unreadable options');
+ assert.equal(remote.executor?.liveLease, true);
+ assert.equal(remote.executor?.runnerExecution, true);
+ assert.notEqual(remote.executor?.cwd, box.repo);
+});