Skip to content

Commit 08dcdea

Browse files
fix(test): restore green Jest suite (jsdom 29 pin + snek coverage) (#382)
Two independent regressions kept "Run JavaScript Tests" red on main and blocked unrelated dependabot PRs: 1. jest-environment-jsdom was bumped to ^30.3.0 (jsdom 26) while jest core stayed at 29. jsdom 26 makes window.location non-configurable, so the `delete window.location` / Object.defineProperty mocks used across the frontend tests throw ("Cannot redefine property: location" / "navigation not implemented"), failing 11 tests. Pin jest-environment-jsdom back to ^29.7.0 to match jest core and restore jsdom 20 location semantics. Verified: full suite green on jsdom 20. 2. snek.js coverage fell below threshold after #340 added the newsletter speech bubble without tests (functions 28.57% vs 40% required). Add a "Newsletter Speech Bubble" test block covering dismissSpeechBubble, both dismiss handlers, and the dismissed/not-dismissed branches. snek.js now exceeds all thresholds (stmts/lines 90%, branches 100%, funcs 71%) with no threshold relaxation. Full suite: 15 suites, 423 tests passing with --coverage --ci. Follow-up (separate PR): modernise the location mocks (history.replaceState) so the suite can move to jest + jsdom v30.
1 parent d33dd22 commit 08dcdea

3 files changed

Lines changed: 487 additions & 724 deletions

File tree

0 commit comments

Comments
 (0)