☕️ Classic, reliable, trusted test framework for Node.js and the browser
Displaying the number of pending specs
Attila Domokos1b70b5774660
diff --git a/lib/reporters/base.js b/lib/reporters/base.jsindex fddd0bb1..d06217c0 100644--- a/lib/reporters/base.js+++ b/lib/reporters/base.js@@ -193,7 +193,7 @@ exports.list = function(failures){function Base(runner) {var self = this- , stats = this.stats = { suites: 0, tests: 0, passes: 0, failures: 0 }+ , stats = this.stats = { suites: 0, tests: 0, passes: 0, pendings: 0, failures: 0 }, failures = this.failures = [];if (!runner) return;@@ -237,6 +237,11 @@ function Base(runner) {stats.end = new Date;stats.duration = new Date - stats.start;});++ runner.on('pending', function(){+ stats.pendings = stats.pendings || 0;+ stats.pendings++;+ });}/**@@ -248,17 +253,30 @@ function Base(runner) {Base.prototype.epilogue = function(){var stats = this.stats- , fmt;+ , fmt+ , tests;console.log();+ var pluralizeTest = function(numberOfTests) {+ if (numberOfTests === 1) {+ return "test";+ }+ else {+ return "tests";+ }+ }+// failureif (stats.failures) {fmt = color('bright fail', ' ✖')- + color('fail', ' %d of %d tests failed')+ + color('fail', ' %d of %d %s failed')+ color('light', ':')- console.error(fmt, stats.failures, this.runner.total);+ console.error(fmt,+ stats.failures,+ this.runner.total,+ pluralizeTest(this.runner.total));Base.list(this.failures);console.error();return;@@ -266,10 +284,24 @@ Base.prototype.epilogue = function(){// passfmt = color('bright pass', ' ✔')- + color('green', ' %d tests complete')+ + color('green', ' %d %s complete')+ color('light', ' (%dms)');- console.log(fmt, stats.tests || 0, stats.duration);+ console.log(fmt,+ stats.tests || 0,+ pluralizeTest(stats.tests),+ stats.duration);++ // pending+ if (stats.pendings > 0) {+ fmt = color('pending', ' *')+ + color('pending', ' %d %s pending');++ console.log(fmt,+ stats.pendings,+ pluralizeTest(stats.pendings));+ }+console.log();};