Skip to content

Extract shared test runner, migrate 146 test files - #161

Merged
w4ffl35 merged 1 commit into
masterfrom
fix/test-runner-dedup
Oct 13, 2026
Merged

w4ffl35 merged 1 commit into
masterfrom
fix/test-runner-dedup

Conversation

@w4ffl35

@w4ffl35 w4ffl35 commented Oct 13, 2026

Copy link
Copy Markdown
Member

Closes #138.

Helper. New src/test-runner.ts: runMain(label, tests) file entry plus runSuites(label, tests) returning the failure count (never exits, so files with teardown sequence it before their own exit). Canonical house semantics: per-test try/catch, ok/FAIL + stack lines, exit 1 on failure, All N <label> tests passed summary with the label omitted when empty. A private runOne unifies the 7 per-file runOne copies. Covered by 5 tests in src/test-runner.test.ts, which dogfoods runMain.

Migration (scripted with conservative skip-rules + machine verification, then hand-finished):

  • 100 module-table files: main() replaced by one runMain line.
  • 21 in-main tables hoisted to module scope (including all 7 runOne files, whose private copies are deleted).
  • 20 setup/teardown files: for-loop becomes const failed = await runSuites(...), keeping each file's own exit-check, teardown, and failure flow verbatim (all 20 diffs reviewed by eye; block-scope escapes fixed to let+assign where the exit-check sits outside the try).
  • Hand conversions: claims + local-explore object tables to tuples, main-tree-tripwire fixture rows to withFixture closures, docker-provider skip count preserved as a trailing note.
  • Deliberately unmigrated: fail-fast runners (skills, muse-cache-qualification, 13 sequential files, 11 top-level loops), the fixture-injecting workspace-symbol loop, bespoke runners, and 29 node:test files. Different patterns, not the inlined main() boilerplate this issue targets.

Net +745/−3402. Full suite 267 files green; tsc clean; check-standards clean (112 fixed); check-architecture clean after scoped regen (86 runner-clone + 15 main-nesting keys removed; only expected keys added: 8 helper-inherent console/exit, 5 newly-surfaced fixture-setup clones).

Follow-up (not this PR): the migration surfaced the next duplication layer — central-store redirect setup ×14 and sandbox-assert setup ×2, now visible as clone keys in the baseline. Same treatment (extract fixture helper) whenever we want it.

New src/test-runner.ts: runMain(label, tests) file entry plus
runSuites(label, tests) returning the failure count (never exits, so
files with teardown sequence it before their own exit). Canonical
house semantics byte for byte: per-test try/catch, ok/FAIL + stack
lines, exit 1 on failure, All N <label> tests passed summary with
the label omitted when empty. runOne helper unifies the 7 per-file
runOne copies. Covered by 5 tests in src/test-runner.test.ts, which
dogfoods runMain.

Migration (scripted + machine-verified, then hand-finished):
- 100 module-table files: main() replaced by runMain (1 line).
- 21 in-main tables: hoisted to module scope (incl. all 7 runOne
  files, whose private runOne copies are deleted).
- 20 setup/teardown files: for-loop becomes
  const failed = await runSuites(...), keeping each file's own
  exit-check, teardown, and failure flow verbatim.
- Hand conversions: claims + local-explore object tables to tuples,
  main-tree-tripwire fixture rows to withFixture closures,
  docker-provider skip-note preserved as a trailing note.
- Deliberately unmigrated: fail-fast runners (skills,
  muse-cache-qualification, 13 SEQ files, 11 top-level loops),
  fixture-injecting loops (workspace-symbol ctx), bespoke runners,
  and 29 node:test files. These are different patterns, not the
  inlined main() boilerplate.

Net: +745/-3402 lines. Full suite 267 files green; tsc clean;
check-standards clean (112 violations fixed); check-architecture
clean after scoped regen (86 runner-clone + 15 main-nesting keys
removed; 8 helper-inherent console/exit + 5 newly-surfaced
fixture-setup-clone keys added).

Closes #138.
@w4ffl35
w4ffl35 merged commit d9f0ba2 into master Oct 13, 2026
2 checks passed
@w4ffl35
w4ffl35 deleted the fix/test-runner-dedup branch October 13, 2026 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extract shared test-main boilerplate (runOne/main) into a test helper

1 participant