️ Repo: Convert `lib/utils.js` to ESM
Author: JoshuaKGoldbergCreated May 16, 2026Updated Sep 16, 2026
Labelsstatus: accepting prsarea: repository tooling
Sub-issue of #5400 (Switch from CJS to ESM internally).
lib/utils.js is a widely-consumed utility module still written in CJS. It exports many helper functions via exports.X and is a dependency across much of the core runtime.
File to convert
lib/utils.js
Notes
Per AGENTS.md CJS-to-ESM conventions:
- Prefer named exports over
export default - Rename to
utils.mjs - Update all consumers to use
const { ... } = require("./utils.mjs")(destructured named imports) - There are many call sites across
lib/— a search forrequire.*utilswill surface them all
Source: mochajs/mocha