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.

fix(tests): keep the runner guard browser-free [C7,O5,V4]

Corey Olson04d0cf549d21
diff --git a/bin/run-tests.js b/bin/run-tests.js
index f1d8c2ad..98b9d5bd 100644
--- a/bin/run-tests.js
+++ b/bin/run-tests.js
@@ -1588,7 +1588,7 @@ if (process.argv[1] && resolve(process.argv[1]) === runner) {
// Any browser spawn from this file or a Node child it starts is refused by name (BROWSER_SLOT_REQUIRED).
process.env.PULLBOARD_TEST_BROWSER_SLOT = 'none';
const guard = new URL('../src/browser-slot-guard.js', import.meta.url);
- await import('../src/browser-slot-guard.js');
+ await import(guard.href);
process.env.NODE_OPTIONS = [process.env.NODE_OPTIONS, `--import=${guard.href}`].filter(Boolean).join(' ');
}
}
diff --git a/test/test-resources.test.js b/test/test-resources.test.js
index 0960932d..67d9a508 100644
--- a/test/test-resources.test.js
+++ b/test/test-resources.test.js
@@ -453,3 +453,20 @@ test('spawned starts a Node child that starts the browser', () => {
assert.equal(browserInCall(method, input), null, `${method} ${JSON.stringify(input)} is not a browser`);
}
});
+
+
+test('the actual runner preload stays browser-free while real direct launches stay bound [C7,O5]', async t => {
+ const root = sourceFixture(t, {
+ 'package.json': '{"type":"module"}',
+ 'test/plain.test.js': "import '../bin/run-tests.js';\n",
+ 'test/direct.test.js': "import { spawnSync } from 'node:child_process'; spawnSync(process.env.PULLBOARD_CHROME, ['--version']);\n",
+ });
+ cpSync(resolve(import.meta.dirname, '../src'), join(root, 'src'), { recursive: true });
+ mkdirSync(join(root, 'bin'));
+ copyFileSync(TEST_RUNNER, join(root, 'bin/run-tests.js'));
+ commitSourceFixture(root);
+ assert.equal(await testsNeedBrowser(root, ['test/plain.test.js'], { byLaunch: true }), false,
+ 'importing the actual runner and its refusal-only guard must not claim a browser slot');
+ assert.equal(await testsNeedBrowser(root, ['test/direct.test.js'], { byLaunch: true }), true,
+ 'a real direct browser launcher still needs its browser slot');
+});