Repository navigation
Type-check tests in CI; pass penanceId in tests; test penance turn order - #78
Merged
Merged
Conversation
#39 added a penanceId constructor parameter to RunnerPenance and HealerPenance, but 62 test calls still passed the old four arguments. penanceId was undefined in every test-built penance, every penanceId comparator returned NaN, and sort kept insertion order, so turn order was untested: reversing or deleting the sorts left all tests passing. Nothing caught it because vitest does not type-check, and test/tsconfig.json inherited classic module resolution, which cannot find vitest in node_modules. - test/tsconfig.json: module esnext, moduleResolution bundler, skipLibCheck, noEmit - pass penanceId (= id) in all 62 calls - tests for tickPenance order, the red egg splash tie-break and the cannon target tie-break - npm run typecheck, run in CI Closes #77 Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 #77.
Problem
#39 added a
penanceIdparameter to theRunnerPenanceandHealerPenanceconstructors, but 62 calls intest/still passed 4 arguments.penanceIdwasundefinedin every penance a test built directly, every turn-order comparator computedNaN, andsortkept insertion order. So the penance turn order had no coverage: reversing or deleting the sorts left all tests passing.Nothing caught this because vitest strips types without checking them.
tsccouldn't checktest/either:test/tsconfig.jsoninheritstarget: es2016with nomodulesetting, which meansmoduleResolution: classic. That mode only looks forvitest.ts/vitest.d.tsfiles in parent folders and never looks innode_modules.Changes
test/tsconfig.json: setmodule: esnext,moduleResolution: bundler(how Vite resolves imports),skipLibCheckandnoEmit. The roottsconfig.jsonis unchanged, sobuilt/is identical.penanceId = id. No test puts a runner and a healer in the same game, so the ids don't collide.tick› penance take turns inpenanceIdorder, not insertion order (recordstick()call order)tick› red egg splash ties go to the higherpenanceIdCannon.tick› targets the lowerpenanceIdwhen runners are otherwise tiednpm run typecheck(tsc -p test) added, run in CI before the tests, and documented in the README.Verified
npm run typecheckpasses, all 295 tests pass, and a rebuild leavesbuilt/unchanged.tickPenanceorder reversed / sort deletedpenanceIdtypecheckreports TS2554The outer sort in
applyRedEggSplashesonly decides which landing red egg uses theMath.random()splash rolls first. With forced splash counts the outcome doesn't depend on it, and with random splashes it only changes which egg gets which roll, so there's no deterministic behaviour to pin.🤖 Generated with Claude Code