☕️ Classic, reliable, trusted test framework for Node.js and the browser
Change pending to named export, update AGENTS.md (#5866)
Mark Wiemer96b2b0760dea
diff --git a/AGENTS.md b/AGENTS.mdindex cd8aa64e..6dc9703c 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -130,6 +130,16 @@ Treat these as potential environment/version drift signals. Do not resolve them- If touching browser behavior, always include at least one browser test run.- If touching CLI or node runtime behavior, include smoke + targeted node suite.+### CJS to ESM migration conventions (runtime code)++- Scope: prioritize runtime modules under `lib/`; do not include test fixtures unless explicitly requested.+- For ESM modules, prefer **named exports** over `export default`.+- When consuming ESM from CJS via `require()`, import named bindings from the namespace object:+ - Use `const { SomeName } = require("./file.mjs");`+ - Avoid `require("./file.mjs").default` for runtime modules.+- Keep PRs small and reviewable (roughly <=100 changed lines when practical).+- After each migration slice, update all direct runtime call sites in the same PR to avoid mixed import patterns.+## Docs subsystem notes (`docs/`)- Separate package and lockfile.diff --git a/lib/pending.mjs b/lib/pending.mjsindex df7f8ff3..8e586abc 100644--- a/lib/pending.mjs+++ b/lib/pending.mjs@@ -14,4 +14,4 @@ class PendingError extends Error {}}-export default PendingError;+export { PendingError };diff --git a/lib/runnable.js b/lib/runnable.jsindex 0adf7fa3..f250c7e5 100644--- a/lib/runnable.js+++ b/lib/runnable.js@@ -1,7 +1,7 @@"use strict";var EventEmitter = require("node:events").EventEmitter;-var PendingError = require("./pending.mjs").default;+var { PendingError } = require("./pending.mjs");var debug = require("debug")("mocha:runnable");var milliseconds = require("ms");var utils = require("./utils");diff --git a/lib/runner.js b/lib/runner.jsindex f002a678..6c938f90 100644--- a/lib/runner.js+++ b/lib/runner.js@@ -9,7 +9,7 @@* @private*/var EventEmitter = require("node:events").EventEmitter;-var PendingError = require("./pending.mjs").default;+var { PendingError } = require("./pending.mjs");var utils = require("./utils");var debug = require("debug")("mocha:runner");var Runnable = require("./runnable");diff --git a/test/unit/runner.spec.js b/test/unit/runner.spec.jsindex 7b992439..ada2c575 100644--- a/test/unit/runner.spec.js+++ b/test/unit/runner.spec.js@@ -3,7 +3,7 @@const path = require("node:path");const sinon = require("sinon");const Mocha = require("../../lib/mocha");-const PendingError = require("../../lib/pending.mjs").default;+const { PendingError } = require("../../lib/pending.mjs");const { Suite, Runner, Test, Hook, Runnable } = Mocha;const { noop } = Mocha.utils;const { FATAL, MULTIPLE_DONE, UNSUPPORTED } =