Skip to content

armgit / mocha

Public Imported from GitHub
0

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

fix(deps): update dependency find-up to v8 (#5747)

renovate[bot]ee11d292560e
diff --git a/lib/cli/config.cjs b/lib/cli/config.cjs
index 03b68c92..ccac4eca 100644
--- a/lib/cli/config.cjs
+++ b/lib/cli/config.cjs
@@ -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");
const { createUnparsableFileError } = require("../errors.js");
const utils = require("../utils.cjs");
@@ -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);
}
diff --git a/lib/cli/options.cjs b/lib/cli/options.cjs
index ee205b97..b2f991c3 100644
--- a/lib/cli/options.cjs
+++ b/lib/cli/options.cjs
@@ -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");
const debugModule = require("debug");
const { createUnparsableFileError, isMochaError } = require("../errors.js");
@@ -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 {
diff --git a/package-lock.json b/package-lock.json
index dad7ee3f..bb4adb6a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -13,7 +13,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",
@@ -4037,6 +4037,23 @@
"url": "https://opencollective.com/eslint"
}
},
+ "node_modules/eslint/node_modules/find-up": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
+ "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "locate-path": "^6.0.0",
+ "path-exists": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/espree": {
"version": "11.2.0",
"resolved": "https://registry.npmjs.org/espree/-/espree-11.2.0.tgz",
@@ -4264,15 +4281,85 @@
}
},
"node_modules/find-up": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
- "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-8.0.0.tgz",
+ "integrity": "sha512-JGG8pvDi2C+JxidYdIwQDyS/CgcrIdh18cvgxcBge3wSHRQOrooMD3GlFBcmMJAN9M42SAZjDp5zv1dglJjwww==",
+ "license": "MIT",
"dependencies": {
- "locate-path": "^6.0.0",
- "path-exists": "^4.0.0"
+ "locate-path": "^8.0.0",
+ "unicorn-magic": "^0.3.0"
},
"engines": {
- "node": ">=10"
+ "node": ">=20"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/find-up/node_modules/locate-path": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-8.0.0.tgz",
+ "integrity": "sha512-XT9ewWAC43tiAV7xDAPflMkG0qOPn2QjHqlgX8FOqmWa/rxnyYDulF9T0F7tRy1u+TVTmK/M//6VIOye+2zDXg==",
+ "license": "MIT",
+ "dependencies": {
+ "p-locate": "^6.0.0"
+ },
+ "engines": {
+ "node": ">=20"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/find-up/node_modules/p-limit": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz",
+ "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==",
+ "license": "MIT",
+ "dependencies": {
+ "yocto-queue": "^1.0.0"
+ },
+ "engines": {
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/find-up/node_modules/p-locate": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz",
+ "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==",
+ "license": "MIT",
+ "dependencies": {
+ "p-limit": "^4.0.0"
+ },
+ "engines": {
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/find-up/node_modules/unicorn-magic": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.3.0.tgz",
+ "integrity": "sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/find-up/node_modules/yocto-queue": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.2.2.tgz",
+ "integrity": "sha512-4LCcse/U2MHZ63HAJVE+v71o7yOdIe4cZ70Wpf8D/IyjDKYQLV5GD46B+hSTjJsvV5PztjvHoU580EftxjDZFQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=12.20"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
@@ -5425,6 +5512,7 @@
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
"integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
+ "dev": true,
"dependencies": {
"p-locate": "^5.0.0"
},
@@ -7143,6 +7231,7 @@
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
"integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
+ "dev": true,
"dependencies": {
"yocto-queue": "^0.1.0"
},
@@ -7157,6 +7246,7 @@
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
"integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
+ "dev": true,
"dependencies": {
"p-limit": "^3.0.2"
},
@@ -7262,6 +7352,7 @@
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
+ "dev": true,
"engines": {
"node": ">=8"
}
@@ -9482,6 +9573,7 @@
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
"integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
+ "dev": true,
"engines": {
"node": ">=10"
},
diff --git a/package.json b/package.json
index 0014e9f8..e193b59f 100644
--- a/package.json
+++ b/package.json
@@ -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",
diff --git a/test/node-unit/cli/config.spec.cjs b/test/node-unit/cli/config.spec.cjs
index 85ae6900..c56c4a0b 100644
--- a/test/node-unit/cli/config.spec.cjs
+++ b/test/node-unit/cli/config.spec.cjs
@@ -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;
diff --git a/test/node-unit/cli/options.spec.js b/test/node-unit/cli/options.spec.js
index 997d6de7..3e93f312 100644
--- a/test/node-unit/cli/options.spec.js
+++ b/test/node-unit/cli/options.spec.js
@@ -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;