Skip to content

Conversation

@JamieMagee
Copy link
Contributor

Summary

This PR enables writing tests in TypeScript by using Node 24's native type stripping. No build step or loader required.

Changes

  • Add @tsconfig/node-ts dependency
  • Extend tsconfig.json with the node-ts config
  • Update mocha script to run both .js and .ts test files
  • Convert test/lib/resultCoordinates.js to TypeScript as a proof of concept

How it works

Node 24 strips TypeScript types at runtime, so .ts files run directly without transpilation. Mocha picks up both JS and TS files, allowing incremental migration.

Testing

npm run mocha

The migrated test passes alongside existing JS tests.

Add @tsconfig/node-ts to support running .ts test files directly with
Node 24's built-in type stripping. Migrate resultCoordinates test as
proof of concept.

- Add @tsconfig/node-ts dependency
- Extend tsconfig.json with node-ts config
- Update mocha script to include .ts files
- Convert test/lib/resultCoordinates.js to TypeScript
- Add test/**/*.ts to tsconfig include array so tests are type-checked
- Disable verbatimModuleSyntax to allow ESM imports in .ts files
- Update ResultCoordinates constructor to accept null for namespace
- Restore original null value in test to preserve test coverage
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