Skip to content

armgit / mocha

Public Imported from GitHub
0

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

chore: unify caught errors as err (#5439)

zagabid4912e705cf9
diff --git a/browser-entry.js b/browser-entry.js
index 4e6f9e93..e8a848aa 100644
--- a/browser-entry.js
+++ b/browser-entry.js
@@ -79,8 +79,8 @@ process.on = function (e, fn) {
}
};
-process.listeners = function (e) {
- if (e === 'uncaughtException') {
+process.listeners = function (err) {
+ if (err === 'uncaughtException') {
return uncaughtExceptionHandlers;
}
return [];
diff --git a/lib/cli/run-helpers.js b/lib/cli/run-helpers.js
index d9c6256c..1d16c285 100644
--- a/lib/cli/run-helpers.js
+++ b/lib/cli/run-helpers.js
@@ -285,8 +285,8 @@ exports.validateLegacyPlugin = (opts, pluginType, map = {}) => {
// Try to load reporters from a cwd-relative path
try {
map[pluginId] = require(path.resolve(pluginId));
- } catch (e) {
- throw createUnknownError(e);
+ } catch (err) {
+ throw createUnknownError(err);
}
}
}
diff --git a/lib/cli/watch-run.js b/lib/cli/watch-run.js
index eb794a56..8efb7a2c 100644
--- a/lib/cli/watch-run.js
+++ b/lib/cli/watch-run.js
@@ -314,8 +314,8 @@ const createRerunner = (mocha, watcher, {beforeRun} = {}) => {
console.error(`${logSymbols.info} [mocha] waiting for changes...`);
}
});
- } catch (e) {
- console.error(e.stack);
+ } catch (err) {
+ console.error(err.stack);
}
};
diff --git a/lib/mocha.js b/lib/mocha.js
index 374f7b1d..d4365e8f 100644
--- a/lib/mocha.js
+++ b/lib/mocha.js
@@ -346,8 +346,8 @@ Mocha.prototype.reporter = function (reporterName, reporterOptions) {
// Try to load reporters from a cwd-relative path
try {
reporter = require(path.resolve(reporterName));
- } catch (e) {
- throw createInvalidReporterError(e.message, reporterName);
+ } catch (err) {
+ throw createInvalidReporterError(err.message, reporterName);
}
}
}
diff --git a/test/integration/helpers.js b/test/integration/helpers.js
index a6ab867a..43f924e1 100644
--- a/test/integration/helpers.js
+++ b/test/integration/helpers.js
@@ -504,7 +504,7 @@ function touchFile(filepath) {
fs.mkdirSync(path.dirname(filepath), { recursive: true });
try {
fs.utimesSync(filepath, touchRef, touchRef);
- } catch (e) {
+ } catch (err) {
const fd = fs.openSync(filepath, 'a');
fs.closeSync(fd);
}