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", }, diff --git a/mocha.mjs b/mocha.mjs new file mode 100644 index 0000000000..2f90c72d6b --- /dev/null +++ b/mocha.mjs @@ -0,0 +1,36 @@ +// this built file is not committed to the repo +/* eslint-disable-next-line n/no-missing-import */ +import "./mocha.js"; + +const { mocha } = globalThis; +const after = mocha.after.bind(mocha); +const afterEach = mocha.afterEach.bind(mocha); +const before = mocha.before.bind(mocha); +const beforeEach = mocha.beforeEach.bind(mocha); +const context = mocha.context.bind(mocha); +const describe = mocha.describe.bind(mocha); +const it = mocha.it.bind(mocha); +const run = mocha.run.bind(mocha); +const setup = mocha.setup.bind(mocha); +const specify = mocha.specify.bind(mocha); +const xcontext = mocha.xcontext.bind(mocha); +const xdescribe = mocha.xdescribe.bind(mocha); +const xit = mocha.xit.bind(mocha); +const xspecify = mocha.xspecify.bind(mocha); + +export { + after, + afterEach, + before, + beforeEach, + context, + describe, + it, + run, + setup, + specify, + xcontext, + xdescribe, + xit, + xspecify, +}; 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": {