Skip to content

armgit / mocha

Public Imported from GitHub
0

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

most reporters using epilogue

Tj Holowaychuk29888c4e8230
diff --git a/Makefile b/Makefile
index f5c5d188..c924e9fe 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ TESTS = test/*.js
test:
@./bin/mocha \
--require should \
- --reporter list \
+ --reporter spec \
--ui bdd \
$(TESTS)
diff --git a/lib/reporters/dot.js b/lib/reporters/dot.js
index a1e56450..2995b7b9 100644
--- a/lib/reporters/dot.js
+++ b/lib/reporters/dot.js
@@ -44,23 +44,11 @@ function Dot(runner) {
process.stdout.write(color('fail', '.'));
});
- // tests are complete, output some stats
- // and the failures if any
- runner.on('end', function(){
- console.log('\n');
- if (stats.failures) {
- 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 || 0
- , stats.duration);
- }
- console.log();
- process.exit(stats.failures);
- });
-}
\ No newline at end of file
+ runner.on('end', self.epilogue.bind(self));
+}
+
+/**
+ * Inherit from `Base.prototype`.
+ */
+
+Dot.prototype.__proto__ = Base.prototype;
\ No newline at end of file
diff --git a/lib/reporters/landing.js b/lib/reporters/landing.js
index 55904912..f877590a 100644
--- a/lib/reporters/landing.js
+++ b/lib/reporters/landing.js
@@ -83,22 +83,11 @@ function Landing(runner) {
stream.write('\033[0m');
});
- runner.on('end', function(){
- cursor.show();
- console.log('\n');
- if (stats.failures) {
- 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 || 0
- , stats.duration);
- }
- console.log();
- process.exit(stats.failures);
- });
-}
\ No newline at end of file
+ runner.on('end', self.epilogue.bind(self));
+}
+
+/**
+ * Inherit from `Base.prototype`.
+ */
+
+Landing.prototype.__proto__ = Base.prototype;
\ No newline at end of file
diff --git a/lib/reporters/list.js b/lib/reporters/list.js
index d36976c0..2998f54b 100644
--- a/lib/reporters/list.js
+++ b/lib/reporters/list.js
@@ -41,8 +41,6 @@ function List(runner) {
console.log(color('fail', ' %d) %s'), n++, test.fullTitle());
});
- // tests are complete, output some stats
- // and the failures if any
runner.on('end', self.epilogue.bind(self));
}
diff --git a/lib/reporters/progress.js b/lib/reporters/progress.js
index 147b4f7a..2c9e5513 100644
--- a/lib/reporters/progress.js
+++ b/lib/reporters/progress.js
@@ -71,14 +71,12 @@ function Progress(runner, options) {
// and the failures if any
runner.on('end', function(){
Base.cursor.show();
- console.log('\n');
- if (stats.failures) {
- 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 || 0, stats.duration);
- }
- console.log();
- process.exit(stats.failures);
+ self.epilogue();
});
-}
\ No newline at end of file
+}
+
+/**
+ * Inherit from `Base.prototype`.
+ */
+
+Progress.prototype.__proto__ = Base.prototype;
\ No newline at end of file