Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

build: update npm command for format (#5603)

Nikolas Lennonc6a29ccb38f8
diff --git a/.github/release-please/manifest.json b/.github/release-please/manifest.json
index 7088a91f..e7949865 100644
--- a/.github/release-please/manifest.json
+++ b/.github/release-please/manifest.json
@@ -1 +1 @@
-{".":"12.0.0-beta-3"}
+{ ".": "12.0.0-beta-3" }
diff --git a/.github/workflows/mocha.yml b/.github/workflows/mocha.yml
index e7fa179e..dddbb6e6 100644
--- a/.github/workflows/mocha.yml
+++ b/.github/workflows/mocha.yml
@@ -19,7 +19,7 @@ jobs:
format:
uses: ./.github/workflows/npm-script.yml
with:
- npm-script: format
+ npm-script: format:check
lint:
uses: ./.github/workflows/npm-script.yml
diff --git a/docs-next/src/content/docs/running/configuring.mdx b/docs-next/src/content/docs/running/configuring.mdx
index e4cdb758..432f0189 100644
--- a/docs-next/src/content/docs/running/configuring.mdx
+++ b/docs-next/src/content/docs/running/configuring.mdx
@@ -9,7 +9,7 @@ title: Configuring Mocha (Node.js)
Mocha supports configuration files, typical of modern command-line tools, in several formats:
- **JavaScript**: Create a `.mocharc.js` (or `.mocharc.cjs` when using [`"type"="module"`](/explainers/nodejs-native-esm-support) in your `package.json`)
- in your project's root directory, and export an object (`module.exports = {/* ... */}`) containing your configuration. For native ESM and using `type="module"`
+ in your project's root directory, and export an object (`module.exports = {/* ... */}`) containing your configuration. For native ESM and using `type="module"`
or using `.mjs`, use a default export (`default export {/* ... */}`).
- **YAML**: Create a `.mocharc.yaml` (or `.mocharc.yml`) in your project's root directory.
- **JSON**: Create a `.mocharc.json` (or `.mocharc.jsonc`) in your project's root directory.
diff --git a/docs/index.md b/docs/index.md
index c78aca9e..e0342fca 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -2258,7 +2258,7 @@ The HTML reporter is the default reporter when running Mocha in the browser. It
Mocha supports configuration files, typical of modern command-line tools, in several formats:
- **JavaScript**: Create a `.mocharc.js` (or `.mocharc.cjs` when using [`"type"="module"`](/explainers/nodejs-native-esm-support) in your `package.json`)
- in your project's root directory, and export an object (`module.exports = {/* ... */}`) containing your configuration. For native ESM and using `type="module"`
+ in your project's root directory, and export an object (`module.exports = {/* ... */}`) containing your configuration. For native ESM and using `type="module"`
or using `.mjs`, use a default export (`default export {/* ... */}`).
in your project's root directory, and export an object (`module.exports = {/* ... */}`) containing your configuration.
- **YAML**: Create a `.mocharc.yaml` (or `.mocharc.yml`) in your project's root directory.
diff --git a/lib/nodejs/esm-utils.js b/lib/nodejs/esm-utils.js
index 00837b80..7c5c95b8 100644
--- a/lib/nodejs/esm-utils.js
+++ b/lib/nodejs/esm-utils.js
@@ -98,7 +98,7 @@ const requireModule = async (file, esmDecorator) => {
return require(file);
} catch (requireErr) {
debug("requireModule caught err: %O", requireErr.message);
- if (requireErr.name === 'TSError') {
+ if (requireErr.name === "TSError") {
throw requireErr;
}
try {
diff --git a/mocha.mjs b/mocha.mjs
index 430d2ee2..0176f14d 100644
--- a/mocha.mjs
+++ b/mocha.mjs
@@ -2,7 +2,7 @@
/* eslint-disable-next-line n/no-missing-import */
import "./mocha.js";
-const {mocha, Mocha} = globalThis;
+const { mocha, Mocha } = globalThis;
const mochaExports = {
after: (...args) => globalThis.after?.(...args),
diff --git a/package.json b/package.json
index 64a699e0..75f20b22 100644
--- a/package.json
+++ b/package.json
@@ -52,7 +52,8 @@
"docs:build-new": "cd docs-next && npm i && npm run build-with-old",
"docs:preview": "http-server docs/_site -o",
"docs": "run-s docs-clean docs:api docs:build docs:build-new",
- "format": "prettier --write .",
+ "format:check": "prettier --check .",
+ "format:fix": "prettier --write .",
"lint:installed-check": "installed-check --engine-check",
"lint:knip": "knip --cache",
"lint:code": "eslint . --max-warnings 0",