Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Release 1.7.4

TJ Holowaychuk652df5fba95f
diff --git a/History.md b/History.md
index f23748b0..0830afe3 100644
--- a/History.md
+++ b/History.md
@@ -1,4 +1,11 @@
+1.7.4 / 2012-12-06
+==================
+
+ * add total number of passes and failures to TAP
+ * remove .bind() calls. re #680
+ * fix indexOf. Closes #680
+
1.7.3 / 2012-11-30
==================
diff --git a/mocha.js b/mocha.js
index de329bdb..917faa27 100644
--- a/mocha.js
+++ b/mocha.js
@@ -3269,7 +3269,9 @@ function TAP(runner) {
var self = this
, stats = this.stats
- , n = 1;
+ , n = 1
+ , passes = 0
+ , failures = 1;
runner.on('start', function(){
var total = runner.grepTotal(runner.suite);
@@ -3285,13 +3287,21 @@ function TAP(runner) {
});
runner.on('pass', function(test){
+ passes++;
console.log('ok %d %s', n, title(test));
});
runner.on('fail', function(test, err){
+ failures++;
console.log('not ok %d %s', n, title(test));
console.log(err.stack.replace(/^/gm, ' '));
});
+
+ runner.on('end', function(){
+ console.log('# tests ' + (passes + failures));
+ console.log('# pass ' + passes);
+ console.log('# fail ' + failures);
+ });
}
/**
@@ -3847,7 +3857,7 @@ Runner.prototype.globalProps = function() {
// non-enumerables
for (var i = 0; i < globals.length; ++i) {
- if (~props.indexOf(globals[i])) continue;
+ if (~utils.indexOf(props, globals[i])) continue;
props.push(globals[i]);
}
@@ -4218,7 +4228,9 @@ Runner.prototype.run = function(fn){
// callback
this.on('end', function(){
debug('end');
- process.removeListener('uncaughtException', self.uncaught.bind(self));
+ process.removeListener('uncaughtException', function(err){
+ self.uncaught(err);
+ });
fn(self.failures);
});
@@ -4230,7 +4242,9 @@ Runner.prototype.run = function(fn){
});
// uncaught exception
- process.on('uncaughtException', this.uncaught.bind(this));
+ process.on('uncaughtException', function(err){
+ self.uncaught(err);
+ });
return this;
};
diff --git a/package.json b/package.json
index 8b967e60..e926a9b5 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "mocha"
- , "version": "1.7.3"
+ , "version": "1.7.4"
, "description": "simple, flexible, fun test framework"
, "keywords": ["test", "bdd", "tdd", "tap"]
, "author": "TJ Holowaychuk <[email protected]>"