Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Annotate when exceptions are caught but ignored; closes #3354 (#3356)

P. Roebuck8368722830ed
diff --git a/bin/options.js b/bin/options.js
index 41f7222a..60cbcd70 100644
--- a/bin/options.js
+++ b/bin/options.js
@@ -40,8 +40,8 @@ function getOptions() {
process.argv = process.argv
.slice(0, 2)
.concat(opts.concat(process.argv.slice(2)));
- } catch (err) {
- // ignore
+ } catch (ignore) {
+ // NOTE: should console.error() and throw the error
}
process.env.LOADED_MOCHA_OPTS = true;
diff --git a/lib/browser/progress.js b/lib/browser/progress.js
index 0dcb3418..7bf400b5 100644
--- a/lib/browser/progress.js
+++ b/lib/browser/progress.js
@@ -112,7 +112,7 @@ Progress.prototype.draw = function(ctx) {
var w = ctx.measureText(text).width;
ctx.fillText(text, x - w / 2 + 1, y + fontSize / 2 - 1);
- } catch (err) {
+ } catch (ignore) {
// don't fail if we can't render progress
}
return this;
diff --git a/lib/runner.js b/lib/runner.js
index 3f4ba55e..6aefb34c 100644
--- a/lib/runner.js
+++ b/lib/runner.js
@@ -244,7 +244,7 @@ Runner.prototype.fail = function(test, err) {
try {
err.stack =
this.fullStackTrace || !err.stack ? err.stack : stackFilter(err.stack);
- } catch (ignored) {
+ } catch (ignore) {
// some environments do not take kindly to monkeying with the stack
}