Mocha to Node.js Test Runner
This migrates Mocha 8.x tests to Node.js (22.x, 24.x) test runner
Features
- Automatically adds
node:testimports/requires - Converts global
describe,it, and hooks to imported versions - Transforms
donecallbacks to(t, done)signature - Converts
this.skip()tot.skip() - Converts
this.timeout(N)to{ timeout: N }options - Preserves function styles (doesn't convert between
function()and arrow functions) - Supports both CommonJS and ESM
Examples
Example 1: Basic
diff
Example 2: Async
diff
Example 3: Hooks
diff
Example 4: Done
diff
Example 5: Skipped
diff
Example 6: Dynamic
diff
Example 7: Timeouts
diff
Caveats
node:testdoesn't support theretryoption that Mocha has, so any tests using that will need to be handled separately.