Skip to content

[Testing][Chore] Remove unmaintained service-worker-mock dev dependency - #464

Open
johnemau wants to merge 1 commit into
john-with-claude/node-24-donate-testing-80be4efrom
john-with-claude/miniflare-node24-tests
Open

johnemau wants to merge 1 commit into
john-with-claude/node-24-donate-testing-80be4efrom
john-with-claude/miniflare-node24-tests

Conversation

@johnemau

@johnemau johnemau commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on

Problem

  • Worker tests use unmaintained service-worker-mock.

Root cause

  • The AVA setup replaces Node globals with a service worker mock.
  • the upstream server-worker mock library is no longer maintained and not updated for Node +22

Solution

  • Remove that setup and use native Request and Response.
  • Use request-shaped fakes for CONNECT and TRACE, which native Request rejects.
  • Remove unmaintained service-worker mocking package

@vercel

vercel Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
donate-button Ready Ready Preview Oct 8, 2026 2:27pm UTC

Request Review

@johnemau johnemau changed the title Run Cloudflare Worker tests on Node 24 with Miniflare Migrate Cloudflare Worker tests to Miniflare Sep 30, 2026
@johnemau johnemau changed the title Migrate Cloudflare Worker tests to Miniflare Make Cloudflare Worker tests run on Node 24 Sep 30, 2026
@johnemau johnemau changed the title Make Cloudflare Worker tests run on Node 24 [Testing] Fix: Make Cloudflare Worker tests run on +Node 22 Sep 30, 2026
@johnemau johnemau changed the title [Testing] Fix: Make Cloudflare Worker tests run on +Node 22 [Testing] Fix: Make Cloudflare Worker tests run on Node +22 Sep 30, 2026
@johnemau
johnemau marked this pull request as ready for review September 30, 2026 15:03
Copilot AI balanced review requested due to automatic review settings September 30, 2026 15:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The worker README still incorrectly states that tests use service-worker-mock.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Updates Cloudflare Worker tests to run on Node.js 22 using native web APIs.

Changes:

  • Removes service-worker-mock and its setup.
  • Uses native Request/Response, with fakes for unsupported methods.
  • Cleans related dependencies from package metadata.
File Description
packages/​cloudflare-worker/​test/​handler.ts Migrates tests to native web APIs.
packages/​cloudflare-worker/​test/​_setup.ts Removes service-worker environment setup.
packages/​cloudflare-worker/​ava.config.js Stops loading the removed setup.
packages/​cloudflare-worker/​package.json Removes mock dependencies.
yarn.lock Removes resolved mock packages.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/cloudflare-worker/ava.config.js
@johnemau
johnemau enabled auto-merge (squash) September 30, 2026 23:50
johnemau added a commit that referenced this pull request Oct 5, 2026
Problem: PR #462 and PR #464 both target main, so the Vite migration can be reviewed or merged before its worker test prerequisite.
Root cause: Their branches diverged from the same main commit.
Solution: Merge the worker test branch into PR #462 and reconcile yarn.lock so the Vite branch contains the worker fix.

Manual test:
Expected: The combined branch installs with an immutable lockfile, passes all package tests, builds Vite, and passes root lint on Node 24.
Actual: yarn install --immutable, yarn test, yarn build, and yarn lint passed on Node 24.16.0.

PRs: #464 and #462
@johnemau
johnemau disabled the stack merge October 6, 2026 15:37
@johnemau
johnemau added this pull request to stack #466 October 6, 2026 15:38
@johnemau
johnemau force-pushed the john-with-claude/miniflare-node24-tests branch from 41dfbc0 to c1d037c Compare October 8, 2026 12:09
@johnemau
johnemau removed this pull request from stack #466 October 8, 2026 14:19
@socket-security

socket-security Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedvite@​8.3.1991008298100
Added@​preact/​preset-vite@​2.10.69910010092100
Addedprettier@​3.0.3981009797100

View full report

Remove the service-worker-mock test setup, which replaced Node globals and depends on an unmaintained package. The handler tests build requests with Node's native Request and Response against an assets.every.org.test URL; CONNECT and TRACE, which Request rejects, use request-shaped objects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@johnemau
johnemau force-pushed the john-with-claude/miniflare-node24-tests branch from 1d7ec89 to e1a32df Compare October 8, 2026 14:27
@johnemau
johnemau changed the base branch from main to john-with-claude/node-24-donate-testing-80be4e October 8, 2026 14:28
@johnemau
johnemau added this pull request to stack #469 October 8, 2026 14:28
@johnemau johnemau changed the title [Testing] Fix: Make Cloudflare Worker tests run on Node +22 [Testing][Chore] Remove unmaintained service-worker-mock dev dependency Oct 8, 2026

This branch was successfully deployed

1 active deployment
Preview — e1a32df6 Deployed Oct 8, 2026 by vercel[bot]
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.

2 participants