test(transformers): genuinely cover the peer-dependency load-failure branch - #41
Merged
Merged
Conversation
…branch
The luxon/moment dynamic-import catch (missing peer dep) was previously gamed past
the per-file 90% coverage gate by collapsing the branch to fewer uncovered lines
rather than executing it. Cover it for real instead: mock.module forces
`import('luxon')`/`import('moment')` to throw so the catch actually runs — one
asserting ERR_MODULE_NOT_FOUND maps to the BakerError install hint, one asserting a
generic eval-time error is rethrown untouched. luxon/moment are now 100% covered.
Module mocks only override reliably under a fresh per-file registry, so the test
scripts (and the pre-commit hook, via `bun run test`) now pass `--isolate`. The
catch was restored to its clear if/throw form (the ternary was the line-count
workaround). No runtime behavior change.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Follow-up to #39. The luxon/moment dynamic-import
catch(missing peer dependency) had been pushed past the per-file 90% coverage gate by collapsing the branch to fewer uncovered lines — i.e. gamed, not covered. This covers it for real.mock.moduleforcesimport('luxon')/import('moment')to throw so thecatchactually runs: one test assertsERR_MODULE_NOT_FOUND→ theBakerErrorinstall hint, one asserts a generic eval-time error is rethrown untouched.luxon.ts/moment.tsare now 100% covered (was 89%/87%).--isolate. Module mocks only override reliably under a fresh per-file registry, sotest/test:coverage(and the pre-commit hook viabun run test) now run with--isolate. Full suite green (2473/0).catchwas restored to its clearif/throwform (the ternary was the line-count workaround). No changeset — nothing user-facing changed; npm 5.2.0 behavior is identical.Verification: typecheck, build, test (2473/0), test:coverage (all files ≥90%, luxon/moment 100%), memory, lint, knip — all green.
🤖 Generated with Claude Code