Skip to content

fix(tests): migrate puppeteer to v25 with babel-jest esm transform#289

Merged
denhamparry merged 2 commits into
mainfrom
denhamparry.co.uk/fix/gh-issue-286
May 26, 2026
Merged

fix(tests): migrate puppeteer to v25 with babel-jest esm transform#289
denhamparry merged 2 commits into
mainfrom
denhamparry.co.uk/fix/gh-issue-286

Conversation

@denhamparry
Copy link
Copy Markdown
Owner

Summary

  • Bump puppeteer 24.43.025.1.0, unblocking Dependabot PR fix(deps): bump puppeteer from 24.43.0 to 25.0.4 #285 and future v25+ bumps.
  • Add a babel-jest transform (babel.config.js + @babel/preset-env) and a transformIgnorePatterns rule so Jest can load puppeteer v25's ESM-only entry point (export * from 'puppeteer-core'), which previously threw SyntaxError: Unexpected token 'export'.
  • Remove the now-resolved docs/failing-tests-investigation.md.

Decision (Option B): migrate to v25 rather than pinning to 24.x. The Node-engine blocker is already resolved — commit 44b98fbf moved the CI test matrix to Node 22.x. The deploy-step node-version: "20.x" pin is intentionally left unchanged: it exists for @lhci/cli@0.12.x (Lighthouse, tracked as #287) and does not use puppeteer.

Test plan

  • npm run test:functional — 17/17 pass against a served Hugo site (was: 2 suites failing to load)
  • npm run test:accessibility — 99 checks pass, 0 violations (confirms plain-node require() of the ESM entry works on Node 22.12+)
  • npm install produces no EBADENGINE warning for puppeteer
  • npm audit — 0 vulnerabilities
  • Website Tests GitHub Action green on this PR
  • All acceptance criteria from issue fix(tests): puppeteer v25 breaks Jest functional tests (ESM entry + Node 20 engine) #286 met

Closes #286

Follow-up ideas

Suggestions surfaced during code review of #286. Not required for this PR — consider for a future change.

  • Document the babel-jest transform in CLAUDE.md — add a one-line note to the Testing section explaining why babel.config.js exists (ESM-only deps under CommonJS Jest), so future contributors don't remove it.

🤖 Generated with Claude Code

denhamparry and others added 2 commits May 26, 2026 15:23
Puppeteer v25 ships an ESM-only entry point (export * from
'puppeteer-core'), which the CommonJS Jest functional suites could not
require, throwing "SyntaxError: Unexpected token 'export'".

Add a babel-jest transform (babel.config.js + @babel/preset-env) and a
transformIgnorePatterns rule so Jest can load puppeteer's ESM entry, and
bump puppeteer 24.43.0 -> 25.1.0. The CI Node-engine blocker is already
resolved (test matrix on 22.x, commit 44b98fb); the deploy-step 20.x
pin is intentionally left for @lhci/cli (#287) and does not use
puppeteer.

Verified locally: test:functional 17/17 and test:accessibility (99
checks) pass against a served Hugo site; no puppeteer EBADENGINE
warnings on install. Removes the now-resolved investigation note.

Closes #286

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CI runs cspell over all markdown (not just changed files), surfacing two
pre-existing issues that block PR #289:

- content/talks.md: line-wrapped "trade offs" -> "trade-offs"
- docs/plan/issues/197_*.md: "judgment" -> "judgement" (en-GB)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@denhamparry denhamparry merged commit ed0cbf0 into main May 26, 2026
10 checks passed
@denhamparry denhamparry deleted the denhamparry.co.uk/fix/gh-issue-286 branch May 26, 2026 14:39
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.

fix(tests): puppeteer v25 breaks Jest functional tests (ESM entry + Node 20 engine)

1 participant