Skip to content

chore: migrate tests to node:test and remove dependencies - #13

Merged
azu merged 2 commits into
masterfrom
claude/node-test-migration
Nov 15, 2026
Merged

azu merged 2 commits into
masterfrom
claude/node-test-migration

Conversation

@azu

@azu azu commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Requested by azu · project thread

Summary

  • Migrate the test suite from mocha to the built-in node:test and node:assert.
  • Remove mocha, @types/mocha, ts-node, and ts-node-test-register. The test file runs through Node.js type stripping, so no TypeScript loader is needed.
  • Update typescript to 7.0.2, @types/node to 22, and packageManager to npm@12.2.2.
  • TypeScript 7 removed moduleResolution: node10, so tsconfig.json now uses module: node20 (which still emits CommonJS because package.json has no type) and sets rootDir.
  • Run CI on Node.js 22 and 24, and tidy the workflow so it passes actionlint (pinned action SHAs, permissions, concurrency, timeout-minutes, push limited to master).
  • The boundary runtime dependency is kept as is.

Notes

  • Runtime behavior is unchanged. src/ is not modified.
  • The test imports the built lib/structured-source.js, so npm test runs npm run build first. This tests the published output and avoids the MODULE_TYPELESS_PACKAGE_JSON warning that importing src/*.ts from a typeless package would cause. test/package.json sets "type": "module" for the test directory only.
  • tsc -p test still type-checks the tests, which ts-node did before.
  • No engines field was added, so consumers are not affected. Only the development and CI environment now needs Node.js 22.18+ (type stripping on by default).

Verification

  • npm test: 5 tests pass on Node.js 22.23. A deliberately broken assertion makes it fail.
  • lib/structured-source.js and lib/structured-source.d.ts built with TypeScript 7 are identical to the ones built from master with TypeScript 4.9 (ignoring trailing whitespace).
  • actionlint reports no errors.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TSdrAHhCYSLRo6b3xvNrX3

- Replace mocha, ts-node, and ts-node-test-register with node:test and node:assert
- Inline upperBound and remove the boundary runtime dependency
- Update TypeScript to 5.9 and @types/node to 22
- Run CI on Node.js 22 and 24 and tidy the workflow with actionlint

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TSdrAHhCYSLRo6b3xvNrX3
Co-authored-by: azu <azu@users.noreply.github.com>
@azu azu added the Type: Refactoring A code change that neither fixes a bug nor adds a feature label Nov 15, 2026 — with Claude
@azu azu self-assigned this Nov 15, 2026
- Update typescript to 7.0.2 and packageManager to npm@12.2.2
- Switch to module node20 because TypeScript 7 removed moduleResolution node10
- Keep the boundary dependency as before

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TSdrAHhCYSLRo6b3xvNrX3
Co-authored-by: azu <azu@users.noreply.github.com>
@azu
azu merged commit dd43f9b into master Nov 15, 2026
2 checks passed
@azu
azu deleted the claude/node-test-migration branch November 15, 2026 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Refactoring A code change that neither fixes a bug nor adds a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant