fix(examples): the verbose-content test moves into the step that wires it [skip-docs]
Operator 2026-10-09: step 6 of examples/01-add-verbose-flag only added a test for behaviour step 5 delivered - the pattern PLAN_STEP_TESTS_ONLY warns on. It now lands in step 5 (Verify: the new test, red before the wiring; Regression: the stability harness), the help-text step becomes step 6, and progress.json follows (6 steps). Steps 1-2 (golden capture and stability harness, tests of today's behaviour that cannot be red) keep the warning; a step type for them is a wave 3 question. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8f3417eed9
commit
73262b6c84
3 changed files with 39 additions and 46 deletions
|
|
@ -19,7 +19,7 @@ import { tmpdir } from 'node:os';
|
|||
import { dirname, join } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { validatePlan, validatePlanContent } from '../../lib/validators/plan-validator.mjs';
|
||||
import { stepTestsOnly } from '../../lib/parsers/plan-schema.mjs';
|
||||
import { parseStepFields, sliceSteps, stepTestsOnly } from '../../lib/parsers/plan-schema.mjs';
|
||||
import { proveRed } from '../../lib/verification/red-proof.mjs';
|
||||
import { runCriteria } from '../../lib/verification/criteria-runner.mjs';
|
||||
import { buildPlan } from '../helpers/plan-v18-builder.mjs';
|
||||
|
|
@ -191,6 +191,26 @@ test('5: a nested `node --test` on a failing test is red even when NODE_TEST_CON
|
|||
}
|
||||
});
|
||||
|
||||
// Operator 2026-10-09: the example's verbose-content test moves into the step
|
||||
// that wires the verbose output; steps 1-2 (golden capture and the stability
|
||||
// harness: tests of today's behaviour, never red) keep the warning, and a step
|
||||
// type for them is a wave 3 question.
|
||||
test('1: the example plan warns only on its two golden/stability steps; the verbose test sits with the code', () => {
|
||||
const r = validatePlan(join(ROOT, 'examples', '01-add-verbose-flag', 'plan.md'));
|
||||
const w = r.warnings.filter((x) => x.code === 'PLAN_STEP_TESTS_ONLY').map((x) => x.message.match(/Step (\d+)/)[1]);
|
||||
assert.deepEqual(w, ['1', '2']);
|
||||
const text = readFileSync(join(ROOT, 'examples', '01-add-verbose-flag', 'plan.md'), 'utf8');
|
||||
const step = sliceSteps(text).find((s) => /tests\/cli-verbose-flag\.test\.mjs/.test(parseStepFields(s.body).get('Files')?.text ?? ''));
|
||||
assert.ok(step, 'a step lists tests/cli-verbose-flag.test.mjs in Files');
|
||||
assert.match(parseStepFields(step.body).get('Files').text, /src\/commands\/login\.mjs/);
|
||||
// The run record follows the plan: one entry per step.
|
||||
const progress = JSON.parse(readFileSync(join(ROOT, 'examples', '01-add-verbose-flag', 'progress.json'), 'utf8'));
|
||||
const n = r.parsed.steps.length;
|
||||
assert.equal(progress.total_steps, n);
|
||||
assert.equal(progress.current_step, n);
|
||||
assert.deepEqual(progress.steps.map((s) => s.n), Array.from({ length: n }, (_, i) => i + 1));
|
||||
});
|
||||
|
||||
// Guard against a reading of the example that counts nothing: it has steps.
|
||||
test('3: the example plan is read (six or more steps)', () => {
|
||||
const text = readFileSync(join(ROOT, 'examples', '01-add-verbose-flag', 'plan.md'), 'utf8');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue