Repository navigation
Extract shared test runner, migrate 146 test files - #161
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #138.
Helper. New
src/test-runner.ts:runMain(label, tests)file entry plusrunSuites(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 passedsummary with the label omitted when empty. A privaterunOneunifies the 7 per-filerunOnecopies. Covered by 5 tests insrc/test-runner.test.ts, which dogfoodsrunMain.Migration (scripted with conservative skip-rules + machine verification, then hand-finished):
main()replaced by onerunMainline.runOnefiles, whose private copies are deleted).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 tolet+assign where the exit-check sits outside thetry).withFixtureclosures, docker-provider skip count preserved as a trailing note.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.