Skip to content

refactor(dev-server-hmr): migrate tests to node:test#3093

Open
bennypowers wants to merge 1 commit into
masterfrom
migrate/dev-server-hmr-node-test
Open

refactor(dev-server-hmr): migrate tests to node:test#3093
bennypowers wants to merge 1 commit into
masterfrom
migrate/dev-server-hmr-node-test

Conversation

@bennypowers
Copy link
Copy Markdown
Member

Summary

  • Migrate @web/dev-server-hmr tests from mocha/chai/hanbi to node:test + node:assert/strict + node:test mock
  • 2 TS test files + utils.ts, hanbi stubs replaced with mock.method
  • import type for koa Context and puppeteer Browser/HTTPResponse/Page
  • --experimental-strip-types for CI compat

Test plan

  • 18/18 tests pass on Node 22.22.3 with Chrome + NODE_OPTIONS='--no-experimental-strip-types' (1 skipped)
  • ESLint clean
  • Prettier clean
  • Code review clean

…:test

Replace mocha globals, chai assertions, and hanbi stubs with node:test,
node:assert/strict, and node:test mock API across 2 test files + utils.ts.

- `import { stubMethod, restore } from 'hanbi'` -> `mock` from `node:test`
- `stubMethod(obj, 'send')` -> `mock.method(obj, 'send')`
- `restoreStubs()` -> `mock.restoreAll()`
- `stub.firstCall!.args[0]` -> `stub.mock.calls[0].arguments[0]`
- `stub.callCount` -> `stub.mock.callCount()`
- `stub.getCall(n)!.args[0]` -> `stub.mock.calls[n].arguments[0]`
- `import type { Context } from 'koa'` (type-only in utils.ts)
- `import type { Browser, HTTPResponse, Page } from 'puppeteer'` (type-only)
- `launch as launchPuppeteer` -> `import puppeteer` + `puppeteer.launch()`
- `../src/*.js` -> `../dist/*.js`, `./utils.js` -> `./utils.ts`
- `__dirname` -> `import.meta.dirname`
- Add `--experimental-strip-types` for CI compat

Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 2, 2026

⚠️ No Changeset found

Latest commit: 98555b0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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