Skip to content

test(test-runner-core): migrate tests to node:test#3094

Merged
bashmish merged 4 commits into
masterfrom
migrate/test-runner-core-node-test
Jun 17, 2026
Merged

test(test-runner-core): migrate tests to node:test#3094
bashmish merged 4 commits into
masterfrom
migrate/test-runner-core-node-test

Conversation

@bennypowers

Copy link
Copy Markdown
Member

Summary

  • Migrate 2 test files (22 tests) from mocha/chai/hanbi to node:test/node:assert/mock
  • Replace hanbi.spy() + .handler pattern with mock.fn() (function is callable directly)
  • Replace hanbi.stubMethod() with mock.method()
  • Replace __dirname with import.meta.dirname
  • Replace src/ imports with dist/ imports for native type stripping
  • Separate type-only imports with import type
  • Increase timeout margins on 2 timing-sensitive scheduler tests for node:test event loop compatibility
  • Update test:node script from mocha to node --experimental-strip-types --test --test-force-exit

Test plan

  • All 22 tests pass locally on Node 22.22.3
  • Tests pass reliably across multiple consecutive runs (no flakiness)
  • Lint passes
  • Build passes

Replace mocha/chai/hanbi with node:test, node:assert/strict, and
node:test mock API across both test files (22 tests).

Key changes:
- hanbi.spy() + .handler pattern -> mock.fn() (function is callable)
- hanbi.stubMethod() -> mock.method()
- __dirname -> import.meta.dirname
- src/ imports -> dist/ imports for native type stripping
- Type-only imports separated with `import type`
- Increased timeout margins on timing-sensitive tests for node:test
  event loop compatibility

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

changeset-bot Bot commented Jun 2, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: d9768c9

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

bennypowers and others added 3 commits June 2, 2026 16:48
Systematically increase all async wait timeouts from 1-4ms to 5-20ms
across TestScheduler tests. CI runners are slower than local machines,
causing timing-sensitive tests to fail when async operation chains
(stopSession + startSession) don't complete within tight windows.

Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bashmish bashmish merged commit 68085c9 into master Jun 17, 2026
6 of 7 checks passed
@bashmish bashmish deleted the migrate/test-runner-core-node-test branch June 17, 2026 09:19
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