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.
JavaScript agentic-codingai-agentsai-governanceautonomous-agentsclaude-codeclicode-reviewcodexcoding-agentsdeveloper-toolsgit-hooksllmlocal-firstmulti-agentsoftware-factoryspec-driven-developmentverificationvibe-coding
fix(test): keep reporter stable on Node 24 [C7]
Corey Olson8a71089ba397
diff --git a/bin/run-tests.js b/bin/run-tests.jsindex 285bc82c..fd2604eb 100644--- a/bin/run-tests.js+++ b/bin/run-tests.js@@ -139,13 +139,16 @@ function testEnvironment(sandbox) {* @returns {import('node:child_process').SpawnSyncReturns<string>}*/function runTests(args, env) {- return spawnSync(process.execPath, [+ const reporter = args.some((argument) => argument === '--test-reporter' || argument.startsWith('--test-reporter='));+ const nodeArgs = ['--disable-warning=ExperimentalWarning','--test',+ ...(!reporter ? ['--test-reporter=tap'] : []),'--import',runner,...args,- ], { env, stdio: 'inherit' });+ ];+ return spawnSync(process.execPath, nodeArgs, { env, stdio: 'inherit' });}/**diff --git a/test/run-tests-reporter.test.js b/test/run-tests-reporter.test.jsnew file mode 100644index 00000000..ddba3e0d--- /dev/null+++ b/test/run-tests-reporter.test.js@@ -0,0 +1,71 @@+/** Keep the production runner's report stable across Node versions and caller options [C7]. */+import assert from 'node:assert/strict';+import { spawnSync } from 'node:child_process';+import { mkdtempSync, rmSync, writeFileSync, readFileSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join } from 'node:path';+import { fileURLToPath } from 'node:url';+import { test } from 'node:test';++const runner = fileURLToPath(new URL('../bin/run-tests.js', import.meta.url));++/** Create a fixture that observes actual child arguments and returns the runner result. */+function runReporterFixture(t, reporterArgs = []) {+ const root = mkdtempSync(join(tmpdir(), 'pullboard-run-tests-reporter-'));+ t.after(() => rmSync(root, { recursive: true, force: true }));+ const fixture = join(root, 'reporter.test.js');+ const preload = join(root, 'capture-args.mjs');+ const capture = join(root, 'child-args.json');+ writeFileSync(join(root, 'package.json'), JSON.stringify({ type: 'module' }));+ writeFileSync(fixture, "import { test } from 'node:test';\ntest('reporter fixture [C7]', () => {});\n");+ writeFileSync(preload, `import cp from 'node:child_process';+import fs from 'node:fs';+import { syncBuiltinESMExports } from 'node:module';+const original = cp.spawnSync;+/** Record the runner's actual child argv before allowing the test process to start. */+cp.spawnSync = function captureNodeTestArgs(file, args, options) {+ if (String(file) === process.execPath && args?.includes('--test')) {+ fs.writeFileSync(process.env.PULLBOARD_REPORTER_CAPTURE_FILE, JSON.stringify(args));+ }+ return original.call(this, file, args, options);+};+syncBuiltinESMExports();+`);++ const result = spawnSync(process.execPath, [runner, ...reporterArgs, fixture], {+ cwd: root,+ env: {+ ...process.env,+ NODE_OPTIONS: `--import="${preload}"`,+ PULLBOARD_REPORTER_CAPTURE_FILE: capture,+ },+ encoding: 'utf8',+ timeout: 15_000,+ });+ const output = `${result.stdout ?? ''}${result.stderr ?? ''}`;+ const childArgs = JSON.parse(readFileSync(capture, 'utf8'));+ return { result, output, childArgs };+}++test('run-tests prints TAP on every Node version and keeps a caller reporter [C7]', (t) => {+ const defaultReporter = runReporterFixture(t);+ assert.equal(defaultReporter.result.status, 0, defaultReporter.output);+ assert.match(defaultReporter.output, /^TAP version \d+/mu);+ assert.match(defaultReporter.output, /^ok \d+ - reporter fixture \[C7\]/mu);+ assert.ok(defaultReporter.childArgs.includes('--test-reporter=tap'), 'the production child receives the explicit TAP reporter');++ const callerReporter = runReporterFixture(t, ['--test-reporter=spec']);+ assert.equal(callerReporter.result.status, 0, callerReporter.output);+ assert.ok(callerReporter.childArgs.includes('--test-reporter=spec'), 'the caller option reaches the production child');+ assert.ok(!callerReporter.childArgs.includes('--test-reporter=tap'), 'the default does not override a caller reporter');+ assert.doesNotMatch(callerReporter.output, /^TAP version \d+/mu);+ assert.match(callerReporter.output, /reporter fixture \[C7\]/u);++ const splitCallerReporter = runReporterFixture(t, ['--test-reporter', 'spec']);+ assert.equal(splitCallerReporter.result.status, 0, splitCallerReporter.output);+ const splitReporterIndex = splitCallerReporter.childArgs.indexOf('--test-reporter');+ assert.ok(splitReporterIndex >= 0, 'the separate reporter flag reaches the child');+ assert.equal(splitCallerReporter.childArgs[splitReporterIndex + 1], 'spec');+ assert.ok(!splitCallerReporter.childArgs.includes('--test-reporter=tap'), 'the default does not override the separate caller option');+ assert.doesNotMatch(splitCallerReporter.output, /^TAP version \d+/mu);+});