Skip to content

test(transformers): genuinely cover the peer-dependency load-failure branch - #41

Merged
parkrevil merged 1 commit into
mainfrom
test/cover-peer-dep-load-failure
Jun 22, 2026
Merged

test(transformers): genuinely cover the peer-dependency load-failure branch#41
parkrevil merged 1 commit into
mainfrom
test/cover-peer-dep-load-failure

Conversation

@parkrevil

Copy link
Copy Markdown
Contributor

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.

  • Real branch execution. mock.module forces import('luxon')/import('moment') to throw so the catch actually runs: one test asserts ERR_MODULE_NOT_FOUND → the BakerError install hint, one asserts a generic eval-time error is rethrown untouched. luxon.ts/moment.ts are now 100% covered (was 89%/87%).
  • --isolate. Module mocks only override reliably under a fresh per-file registry, so test / test:coverage (and the pre-commit hook via bun run test) now run with --isolate. Full suite green (2473/0).
  • No runtime change. The catch was restored to its clear if/throw form (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

…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>
@parkrevil
parkrevil merged commit e157467 into main Jun 22, 2026
1 check passed
@parkrevil
parkrevil deleted the test/cover-peer-dep-load-failure branch June 22, 2026 05:01
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.

1 participant