Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
unparseNodeFlags,
isNodeFlag,
impliesNoTimeouts,
} from "../lib/cli/node-flags.cjs";
} from "../lib/cli/node-flags.js";
import { fileURLToPath } from "node:url";

const debug = d.debug("mocha:cli:mocha");
Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/running/cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Running Mocha in your terminal.

Running `npx mocha --help` will show the full list of available commands:

{/* This output is defined in lib/cli/cli.js and lib/cli/run-option-metadata.cjs */}
{/* This output is defined in lib/cli/cli.js and lib/cli/run-option-metadata.js */}

```plaintext
Usage: mocha [spec..]
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import pc from "picocolors";
import { logSymbols } from "../utils.cjs";

import packageJson from "../../package.json" with { type: "json" };
import { getRunOptionDefinitions } from "./run-option-metadata.cjs";
import { getRunOptionDefinitions } from "./run-option-metadata.js";

const __filename = fileURLToPath(import.meta.url);

Expand Down
17 changes: 5 additions & 12 deletions lib/cli/node-flags.cjs → lib/cli/node-flags.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
"use strict";

/**
* Some settings and code related to Mocha's handling of Node.js/V8 flags.
* @private
* @module
*/

const inspector = require("node:inspector");
import inspector from "node:inspector";
import { isMochaFlag, stripLeadingDashes } from "./run-option-metadata.js";
import { unparseNodeFlags } from "./unparse-args.js";

const nodeFlags = process.allowedNodeEnvironmentFlags;
const {
isMochaFlag,
stripLeadingDashes,
} = require("./run-option-metadata.cjs");
const { unparseNodeFlags } = require("./unparse-args.js");

/**
* These flags are considered "debug" flags.
Expand Down Expand Up @@ -79,7 +75,4 @@ function isInspectorActive() {
return inspector.url() !== undefined;
}

exports.isNodeFlag = isNodeFlag;
exports.impliesNoTimeouts = impliesNoTimeouts;
exports.isInspectorActive = isInspectorActive;
exports.unparseNodeFlags = unparseNodeFlags;
export { isNodeFlag, impliesNoTimeouts, isInspectorActive, unparseNodeFlags };
4 changes: 2 additions & 2 deletions lib/cli/parse-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
isMochaFlag,
stripLeadingDashes,
types,
} from "./run-option-metadata.cjs";
import { isNodeFlag } from "./node-flags.cjs";
} from "./run-option-metadata.js";
import { isNodeFlag } from "./node-flags.js";
import debugModule from "debug";

const debug = debugModule("mocha:cli:parse-args");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use strict";

/**
* Metadata about various options of the `run` command
* @see module:lib/cli/run
Expand Down Expand Up @@ -209,9 +207,11 @@ const expectedTypeForFlag = (flag) => {
);
};

exports.types = types;
exports.aliases = aliases;
exports.getRunOptionDefinitions = getRunOptionDefinitions;
exports.isMochaFlag = isMochaFlag;
exports.expectedTypeForFlag = expectedTypeForFlag;
exports.stripLeadingDashes = stripLeadingDashes;
export {
types,
aliases,
getRunOptionDefinitions,
isMochaFlag,
expectedTypeForFlag,
stripLeadingDashes,
};
2 changes: 1 addition & 1 deletion lib/cli/run.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const {
validateLegacyPlugin,
runMocha,
} = require("./run-helpers.cjs");
const { isInspectorActive } = require("./node-flags.cjs");
const { isInspectorActive } = require("./node-flags.js");
const { ONE_AND_DONES } = require("./one-and-dones.js");
const debug = require("debug")("mocha:cli:run");

Expand Down
2 changes: 1 addition & 1 deletion test/node-unit/cli/mocha-flags.spec.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const {
types,
expectedTypeForFlag,
getRunOptionDefinitions,
} = require("../../../lib/cli/run-option-metadata.cjs");
} = require("../../../lib/cli/run-option-metadata.js");

describe("mocha-flags", function () {
describe("expectedTypeForFlag()", function () {
Expand Down
4 changes: 2 additions & 2 deletions test/node-unit/cli/node-flags.spec.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ const {
impliesNoTimeouts,
isInspectorActive,
unparseNodeFlags,
} = require("../../../lib/cli/node-flags.cjs");
} = require("../../../lib/cli/node-flags.js");

const { isMochaFlag } = require("../../../lib/cli/run-option-metadata.cjs");
const { isMochaFlag } = require("../../../lib/cli/run-option-metadata.js");

describe("node-flags", function () {
describe("isNodeFlag()", function () {
Expand Down
2 changes: 1 addition & 1 deletion test/node-unit/cli/run.spec.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const {
getRunOptionDefinitions,
types,
} = require("../../../lib/cli/run-option-metadata.cjs");
} = require("../../../lib/cli/run-option-metadata.js");
const { validateRunOptions } = require("../../../lib/cli/run.cjs");

describe("command", function () {
Expand Down
Loading