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(view): an import before the runner keeps it the runner [C7]

Corey Olsone25573a95df8
diff --git a/test/chrome-fixture.js b/test/chrome-fixture.js
index b4af0bd7..6283a4c6 100644
--- a/test/chrome-fixture.js
+++ b/test/chrome-fixture.js
@@ -181,8 +181,10 @@ export function isRunnerCommand(command) {
const text = String(command);
if (!/(?:^|[\s/])bin\/run-tests\.js(?:\s|$)/u.test(text)) return false;
if (/(?:^|\s)--test(?:\s|$)/u.test(text)) return false;
- // The import value runs up to the next option, so a path with spaces still counts as one value.
- return !/(?:^|\s)--import[=\s](?:(?!\s--)[^])*?bin\/run-tests\.js(?:\s|$)/u.test(text);
+ // Each import value runs to the first module file name that ends it, so a folder with spaces stays inside the value
+ // while `--import ./instrumentation.mjs bin/run-tests.js` still names the runner as the script (#896).
+ const imports = [...text.matchAll(/(?:^|\s)--import[=\s](.*?\.(?:[mc]?js|ts))(?=\s|$)/gu)].map((match) => match[1]);
+ return !imports.some((value) => /(?:^|[\s/:])bin\/run-tests\.js$/u.test(value));
}
/**
diff --git a/test/cockpit/stable.test.js b/test/cockpit/stable.test.js
index 2981942d..5daa6728 100644
--- a/test/cockpit/stable.test.js
+++ b/test/cockpit/stable.test.js
@@ -60,9 +60,11 @@ function stopRecorded(profile, pids) {
test('the runner is bin/run-tests.js with any options, and its workers are not [C7]', () => {
const at = '/Users/someone/Code/Open Source/repo';
for (const command of [`node bin/run-tests.js test/a.test.js`, `node bin/run-tests.js --test-concurrency=1 test/a.test.js`,
- `/usr/local/bin/node ${at}/bin/run-tests.js --test-concurrency=1 ${at}/test/a.test.js`]) assert.equal(isRunnerCommand(command), true, command);
+ `/usr/local/bin/node ${at}/bin/run-tests.js --test-concurrency=1 ${at}/test/a.test.js`,
+ `node --import ./instrumentation.mjs bin/run-tests.js test/a.test.js`, `node --import=./instrumentation.mjs ${at}/bin/run-tests.js`]) assert.equal(isRunnerCommand(command), true, command);
for (const command of [`node --disable-warning=ExperimentalWarning --import ${at}/bin/run-tests.js ${at}/test/a.test.js`,
- `node --import=${at}/bin/run-tests.js ${at}/test/a.test.js`, `node --test test/a.test.js bin/run-tests.js`, `node test/a.test.js`]) assert.equal(isRunnerCommand(command), false, command);
+ `node --import=${at}/bin/run-tests.js ${at}/test/a.test.js`, `node --import ./trace.mjs --import ${at}/bin/run-tests.js ${at}/test/a.test.js`,
+ `node --test test/a.test.js bin/run-tests.js`, `node test/a.test.js`]) assert.equal(isRunnerCommand(command), false, command);
});
/** How each killed process starts the probe: the owner directly, or the runner, with and without its own options. */