refactor(#2268): gen:golden one-command fixture regenerator (#2275)

Phase 3 (convenience form) of golden-parity redesign (epic #2264). Adds npm run gen:golden (regenerates both fixture sets) and points the golden-parity/tree failure messages at it. Full CI-auto-comment deferred (documented in ADR-2264). Closes #2268.
This commit is contained in:
Tom Boucher
2026-07-14 20:18:34 -04:00
committed by GitHub
parent 89b1bef881
commit fc913b37a5
4 changed files with 11 additions and 8 deletions

View File

@@ -90,7 +90,7 @@ for (const runtime of runtimes) {
if (!fs.existsSync(fixturePath)) {
assert.fail(
`Golden fixture missing for runtime '${runtime}': ${fixturePath}\n` +
'Run UPDATE_GOLDEN=1 node --test tests/golden-install-parity.test.cjs to capture.'
'Run "npm run gen:golden" to generate the fixtures (or, for humans, UPDATE_GOLDEN=1 node --test tests/golden-install-parity.test.cjs).'
);
}
@@ -108,7 +108,7 @@ for (const runtime of runtimes) {
if (added.length) lines.push(` added (${added.length}): ${added.join(', ')}`);
if (removed.length) lines.push(` removed (${removed.length}): ${removed.join(', ')}`);
if (changed.length) lines.push(` changed (${changed.length}): ${changed.join(', ')}`);
lines.push('Run UPDATE_GOLDEN=1 to recapture if the change is intentional.');
lines.push('If the change is intentional, run "npm run gen:golden" to regenerate the fixtures (works without node --test; humans may also use UPDATE_GOLDEN=1 node --test).');
assert.deepEqual(actual, golden, lines.join('\n'));
}
});
@@ -146,7 +146,7 @@ test('golden parity — claude (local legacy layout)', async (t) => {
if (!fs.existsSync(fixturePath)) {
assert.fail(
`Golden fixture missing for claude-local: ${fixturePath}\n` +
'Run UPDATE_GOLDEN=1 node --test tests/golden-install-parity.test.cjs to capture.',
'Run "npm run gen:golden" to generate the fixtures (or, for humans, UPDATE_GOLDEN=1 node --test tests/golden-install-parity.test.cjs).',
);
}
@@ -159,7 +159,7 @@ test('golden parity — claude (local legacy layout)', async (t) => {
if (added.length) lines.push(` added (${added.length}): ${added.join(', ')}`);
if (removed.length) lines.push(` removed (${removed.length}): ${removed.join(', ')}`);
if (changed.length) lines.push(` changed (${changed.length}): ${changed.join(', ')}`);
lines.push('Run UPDATE_GOLDEN=1 to recapture if the change is intentional.');
lines.push('If the change is intentional, run "npm run gen:golden" to regenerate the fixtures (works without node --test; humans may also use UPDATE_GOLDEN=1 node --test).');
assert.deepEqual(actual, golden, lines.join('\n'));
}
});

View File

@@ -86,7 +86,7 @@ for (const runtime of runtimes) {
if (!fs.existsSync(fixturePath)) {
assert.fail(
`Install-tree fixture missing for runtime '${runtime}': ${fixturePath}\n` +
'Run UPDATE_INSTALL_TREE=1 node --test tests/golden-install-tree.test.cjs to capture.'
'Run "npm run gen:golden" to generate the fixtures (or, for humans, UPDATE_INSTALL_TREE=1 node --test tests/golden-install-tree.test.cjs).'
);
}
@@ -98,7 +98,7 @@ for (const runtime of runtimes) {
const lines = [`Install-tree mismatch for runtime '${runtime}':`];
if (added.length) lines.push(` added (${added.length}): ${added.join(', ')}`);
if (removed.length) lines.push(` removed (${removed.length}): ${removed.join(', ')}`);
lines.push('Run UPDATE_INSTALL_TREE=1 to recapture if the change is intentional.');
lines.push('If the change is intentional, run "npm run gen:golden" to regenerate the fixtures (works without node --test; humans may also use UPDATE_INSTALL_TREE=1 node --test).');
assert.deepEqual(actual, fixture, lines.join('\n'));
}
});
@@ -132,7 +132,7 @@ test('install tree — claude (local legacy layout)', async (t) => {
if (!fs.existsSync(fixturePath)) {
assert.fail(
`Install-tree fixture missing for claude-local: ${fixturePath}\n` +
'Run UPDATE_INSTALL_TREE=1 node --test tests/golden-install-tree.test.cjs to capture.',
'Run "npm run gen:golden" to generate the fixtures (or, for humans, UPDATE_INSTALL_TREE=1 node --test tests/golden-install-tree.test.cjs).',
);
}
@@ -142,7 +142,7 @@ test('install tree — claude (local legacy layout)', async (t) => {
const lines = ['Install-tree mismatch for claude-local:'];
if (added.length) lines.push(` added (${added.length}): ${added.join(', ')}`);
if (removed.length) lines.push(` removed (${removed.length}): ${removed.join(', ')}`);
lines.push('Run UPDATE_INSTALL_TREE=1 to recapture if the change is intentional.');
lines.push('If the change is intentional, run "npm run gen:golden" to regenerate the fixtures (works without node --test; humans may also use UPDATE_INSTALL_TREE=1 node --test).');
assert.deepEqual(actual, fixture, lines.join('\n'));
}
});