Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Fixed NaN tests completed for 0

Tj Holowaychuk5499a009945a
diff --git a/lib/reporters/dot.js b/lib/reporters/dot.js
index e06aada1..049e2687 100644
--- a/lib/reporters/dot.js
+++ b/lib/reporters/dot.js
@@ -52,7 +52,7 @@ function Dot(runner) {
console.log(color('fail message', ' ✖ %d of %d tests failed'), stats.failures, stats.tests);
Base.list(self.failures);
} else {
- console.log(color('pass message', ' ✔ %d tests completed in %dms'), stats.tests, stats.duration);
+ console.log(color('pass message', ' ✔ %d tests completed in %dms'), stats.tests || 0, stats.duration);
}
console.log();
process.exit(stats.failures);
diff --git a/lib/reporters/landing.js b/lib/reporters/landing.js
index f81c952d..a3e9fefa 100644
--- a/lib/reporters/landing.js
+++ b/lib/reporters/landing.js
@@ -90,7 +90,7 @@ function Landing(runner) {
console.log(color('fail message', ' ✖ %d of the %d passengers didnt make it!'), stats.failures, stats.tests);
Base.list(self.failures);
} else {
- console.log(color('pass message', ' ✔ %d passengers arrived safely in %dms!'), stats.tests, stats.duration);
+ console.log(color('pass message', ' ✔ %d passengers arrived safely in %dms!'), stats.tests || 0, stats.duration);
}
console.log();
process.exit(stats.failures);
diff --git a/lib/reporters/list.js b/lib/reporters/list.js
index 5beed704..83127fc8 100644
--- a/lib/reporters/list.js
+++ b/lib/reporters/list.js
@@ -49,7 +49,7 @@ function List(runner) {
console.log(color('fail message', ' ✖ %d of %d tests failed'), stats.failures, stats.tests);
Base.list(self.failures);
} else {
- console.log(color('pass message', ' ✔ %d tests completed in %dms'), stats.tests, stats.duration);
+ console.log(color('pass message', ' ✔ %d tests completed in %dms'), stats.tests || 0, stats.duration);
}
console.log();
process.exit(stats.failures);
diff --git a/lib/reporters/progress.js b/lib/reporters/progress.js
index 4daa5017..147b4f7a 100644
--- a/lib/reporters/progress.js
+++ b/lib/reporters/progress.js
@@ -76,7 +76,7 @@ function Progress(runner, options) {
console.log(color('fail message', ' ✖ %d of %d tests failed'), stats.failures, stats.tests);
Base.list(self.failures);
} else {
- console.log(color('pass message', ' ✔ %d tests completed in %dms'), stats.tests, stats.duration);
+ console.log(color('pass message', ' ✔ %d tests completed in %dms'), stats.tests || 0, stats.duration);
}
console.log();
process.exit(stats.failures);
diff --git a/test/basic.js b/test/basic.js
new file mode 100644
index 00000000..e69de29b