Skip to content

feat(blog): add mocha-to-node-test-runner migration guide - #9088

Open
Xstoudi wants to merge 1 commit into
nodejs:mainfrom
Xstoudi:feature/blog-post-mocha-migration
Open

feat(blog): add mocha-to-node-test-runner migration guide#9088
Xstoudi wants to merge 1 commit into
nodejs:mainfrom
Xstoudi:feature/blog-post-mocha-migration

Conversation

@Xstoudi

@Xstoudi Xstoudi commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Description

As titles

Related Issues

No related issue

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run pnpm format to ensure the code follows the style guide.
  • I have run pnpm test to check if all tests are passing.
  • I have run pnpm build to check if the website builds without errors.
  • I've covered new added functionality with unit tests if necessary.

@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nodejs-org Error Error Aug 6, 2026 5:30pm

Request Review

@cursor

cursor Bot commented Aug 6, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Documentation-only addition with no application or runtime code changes.

Overview
Adds a new migrations blog post at mocha-to-node-test-runner.mdx documenting the @nodejs/mocha-to-node-test-runner codemod.

The article explains why teams might switch from Mocha to the built-in runner, Node.js ≥18 requirements (and major-version/engine bumps when dropping older Node), which APIs the codemod rewrites (describe/it, hooks, .skip/.only, this.timeout), and how to run it via npx codemod plus switching package.json scripts to node --test. It includes diff-style examples, notes on unsupported Mocha features, and a short recognition of the Mocha project.

Reviewed by Cursor Bugbot for commit ea97e4c. Bugbot is set up for automated code reviews on this repo. Configure here.

@AugustinMauroy

Copy link
Copy Markdown
Member

@nodejs/web-infra what is the Vercel issue ?

@avivkeller

Copy link
Copy Markdown
Member

@Xstoudi Your PR head is outdate with main, please rebase (it'll fix Vercel)

category: migrations
title: Mocha to Node.js Test Runner
layout: blog-post
author: Xstoudi

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
author: Xstoudi
author: xstoudi

Can you update the author map?

Comment on lines +20 to +26
## Node.js Version Requirements

- Node.js v18.0.0 or later (Node.js test runner is available but marked experimental)
- Node.js v20.0.0 or later (Node.js test runner is stable)

> If your package currently supports Node.js versions earlier than v18.0.0, you cannot migrate to the Node.js test runner without dropping support for those versions.
> This requires bumping the major version of your package AND updating the engines field in your package.json to require Node.js >= v18.0.0.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section isn't needed, since those versions are both EOL

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

humm IMO we should keep it because user may have older codebase that use EoL and to update it they can use this codemod.

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.

3 participants