From 28ef8bc5309cb3d0823cfca502b0aa9b3312c3c7 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Wed, 5 Nov 2025 06:30:42 -0700 Subject: [PATCH 1/2] feat: add mocha.mjs export --- mocha.mjs | 24 ++++++++++++++++++++++++ package.json | 1 + 2 files changed, 25 insertions(+) create mode 100644 mocha.mjs diff --git a/mocha.mjs b/mocha.mjs new file mode 100644 index 0000000000..91c46d82c2 --- /dev/null +++ b/mocha.mjs @@ -0,0 +1,24 @@ +import "./mocha.js" + +const { mocha } = globalThis; + +const describe = mocha.describe.bind(mocha); +const context = mocha.context.bind(mocha); +const it = mocha.it.bind(mocha); +const specify = mocha.specify.bind(mocha); +const xdescribe = mocha.xdescribe.bind(mocha); +const xcontext = mocha.xcontext.bind(mocha); +const xit = mocha.xit.bind(mocha); +const xspecify = mocha.xspecify.bind(mocha); +const before = mocha.before.bind(mocha); +const beforeEach = mocha.beforeEach.bind(mocha); +const afterEach = mocha.afterEach.bind(mocha); +const after = mocha.after.bind(mocha); + +const setup = mocha.setup.bind(mocha); +const run = mocha.run.bind(mocha); + +export { + describe, context, it, specify, xdescribe, xcontext, + xit, xspecify, before, beforeEach, afterEach, after, setup, run +}; diff --git a/package.json b/package.json index 2ca471c06f..1bdaa51447 100644 --- a/package.json +++ b/package.json @@ -190,6 +190,7 @@ "mocha.css", "mocha.js", "mocha.js.map", + "mocha.mjs", "browser-entry.js" ], "browser": { From e405d8587085f3102d42cc9016fb02207111c6f6 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Sat, 8 Nov 2025 16:49:40 -0700 Subject: [PATCH 2/2] chore: lint .mjs always as modules --- eslint.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint.config.js b/eslint.config.js index 10d4ad1372..49495fcaec 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -89,7 +89,7 @@ module.exports = [ }, }, { - files: ["test/**/*.mjs"], + files: ["**/*.mjs"], languageOptions: { sourceType: "module", },