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(land): read spec reporter failures so Node 24 names culprits [C7]
Corey Olson7fb5454c725b
diff --git a/src/land.js b/src/land.jsindex 02b88bda..fb0b199e 100644--- a/src/land.js+++ b/src/land.js@@ -62,11 +62,22 @@ function testHash(root, file) {catch { return null; }}-/** Derive failing test identities from TAP names and source locations, refusing unknown paths. */+/** Derive failing test identities from TAP or spec reporter names and source locations, refusing unknown paths. */export function landingFailures(output, root, { excludeCancelled = false } = {}) {const failures = [];let active = null;+ /** A reported path relative to the root, or null when it lies outside it. */+ const inRoot = (path) => {+ const file = isAbsolute(path) ? relative(root, path) : path.replace(/^\.\//u, '');+ return file && !file.startsWith('../') && !file.includes('\\') ? file : null;+ };+ // The spec reporter (Node 24's default for node --test) names each failure as "test at <file>:<line>" then "✖ <name>".+ let specFile;for (const line of output.split('\n')) {+ const at = /^\s*test at (.+?):\d+(?::\d+)?\s*$/u.exec(line);+ if (at) { specFile = inRoot(at[1]); active = null; continue; }+ const spec = specFile !== undefined ? /^\s*\u2716 (.+?)(?: \([\d.]+m?s\))?\s*$/u.exec(line) : null;+ if (spec) { failures.push({ name: spec[1], file: specFile }); specFile = undefined; continue; }const failed = /^\s*not ok\s+\d+\s+-\s+(.*)$/u.exec(line);if (failed) {active = { name: failed[1].replace(/\s+#.*$/u, ''), file: null };@@ -75,9 +86,8 @@ export function landingFailures(output, root, { excludeCancelled = false } = {})}const location = /^\s*location:\s*['"]?(.+?):\d+(?::\d+)?['"]?\s*$/u.exec(line);if (active && location) {- const path = location[1];- const file = isAbsolute(path) ? relative(root, path) : path.replace(/^\.\//u, '');- if (file && !file.startsWith('../') && !file.includes('\\')) active.file = file;+ const file = inRoot(location[1]);+ if (file) active.file = file;}if (excludeCancelled && active && /^\s*failureType:\s*['"]?(?:cancelledByParent|subtestsFailed)['"]?\s*$/u.test(line)) active.omit = true;}diff --git a/test/land.test.js b/test/land.test.jsindex d04b0b07..9422d417 100644--- a/test/land.test.js+++ b/test/land.test.js@@ -1268,6 +1268,9 @@ test('landing diagnostics retain unknown failures and merge subjects obey typedconst root = '/private/landing';const failures = landingFailures(`not ok 1 - located failure\n location: ${root}/test/one.test.js:3:4\nnot ok 2 - unknown failure\n`, root);assert.deepEqual(failures, [{ name: 'located failure', file: 'test/one.test.js' }, { name: 'unknown failure', file: null }]);+ // Node 24 node --test reports with spec by default: its failing-tests summary names each file and test (#1071).+ const spec = landingFailures(`\u2716 red one (1.2ms)\n\u2716 failing tests:\n\ntest at web/red.test.js:6:1\n\u2716 red one (1.2ms)\n AssertionError\n\ntest at /elsewhere/x.test.js:1:1\n\u2716 outside (3ms)\n`, root);+ assert.deepEqual(spec, [{ name: 'red one', file: 'web/red.test.js' }, { name: 'outside', file: null }], 'spec failures keep their file, and an outside path is unknown');const subject = landingSubject({ item_id: 91, item_title: 'A VERY LONG TITLE '.repeat(10), item_spec_ids: 'B3,R3' });assert.equal(subject, 'chore(merge): a very long title a very long title a very long [B3,R3]');assert.ok(subject.length <= 72);