Skip to content
Merged
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
4 changes: 2 additions & 2 deletions lib/cli/config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
const fs = require("node:fs");
const path = require("node:path");
const debug = require("debug")("mocha:cli:config");
const findUp = require("find-up");
const { findUpSync } = require("find-up");

@danielhjacobs danielhjacobs Sep 15, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

find-up 8 is ESM only and does import "unicorn-magic", so this CommonJS require cannot work

@danielhjacobs danielhjacobs Sep 15, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const { createUnparsableFileError } = require("../errors.js");
const utils = require("../utils.cjs");

Expand Down Expand Up @@ -96,7 +96,7 @@ exports.loadConfig = (filepath) => {
* @returns {string|null} Filepath to config, if found
*/
exports.findConfig = (cwd = utils.cwd()) => {
const filepath = findUp.sync(exports.CONFIG_FILES, { cwd });
const filepath = findUpSync(exports.CONFIG_FILES, { cwd });
if (filepath) {
debug("findConfig: found config file %s", filepath);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/cli/options.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const { parseMochaArgs } = require("./parse-args.js");
const { ONE_AND_DONE_ARGS } = require("./one-and-dones.js");
const mocharc = require("../mocharc.json");
const { loadConfig, findConfig } = require("./config.cjs");
const { sync } = require("find-up");
const { findUpSync } = require("find-up");

@danielhjacobs danielhjacobs Sep 15, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has the same issue as #5747 (comment)

const debugModule = require("debug");
const { createUnparsableFileError, isMochaError } = require("../errors.js");

Expand Down Expand Up @@ -81,7 +81,7 @@ const loadPkgRc = (args = {}) => {
return result;
}
result = {};
const filepath = args.package || sync(mocharc.package);
const filepath = args.package || findUpSync(mocharc.package);
if (filepath) {
let configData;
try {
Expand Down
106 changes: 99 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"chokidar": "^5.0.0",
"debug": "^4.3.5",
"diff": "^9.0.0",
"find-up": "^5.0.0",
"find-up": "^8.0.0",
"glob": "^13.0.0",
"is-path-inside": "^3.0.3",
"is-unicode-supported": "^0.1.0",
Expand Down
4 changes: 2 additions & 2 deletions test/node-unit/cli/config.spec.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ describe("cli/config", function () {
let CONFIG_FILES;

beforeEach(function () {
findup = { sync: sinon.stub().returns("/some/path/.mocharc.js") };
findup = sinon.stub().returns("/some/path/.mocharc.js");
const config = rewiremock.proxy(
require.resolve("../../../lib/cli/config.cjs"),
(r) => ({
"find-up": r.by(() => findup),
"find-up": r.by(() => ({ findUpSync: findup })),
}),
);
findConfig = config.findConfig;
Expand Down
2 changes: 1 addition & 1 deletion test/node-unit/cli/options.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const proxyLoadOptions = ({
"node:fs": r.with({ readFileSync }).directChildOnly(),
[mocharcPath]: defaults,
"find-up": r
.by(() => (findupSync ? { sync: findupSync } : {}))
.by(() => (findupSync ? { findUpSync: findupSync } : {}))
.directChildOnly(),
[configPath]: r.with({ findConfig, loadConfig }).directChildOnly(),
})).loadOptions;
Expand Down
Loading