Comparing version 1.0.3 to 1.0.4
{ | ||
"name": "it-fails", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -9,36 +9,38 @@ const mocha = require('mocha'); | ||
Runner.prototype.grep = function() { | ||
this.tests = { | ||
unexpectedPasses: [], | ||
unexpectedFails: [], | ||
expectedFails: [], | ||
pending: [] | ||
} | ||
this.on('pass', (test) => { | ||
if (test.shouldFail) { | ||
this.failures++; | ||
if (this.stats) { | ||
this.stats.unexpectedPasses = this.stats.unexpectedPasses || 0; | ||
this.stats.unexpectedPasses++; | ||
this.stats.passes--; | ||
} | ||
this.tests.unexpectedPasses.push(test); | ||
if (!this.tests) { | ||
this.tests = { | ||
unexpectedPasses: [], | ||
unexpectedFails: [], | ||
expectedFails: [], | ||
pending: [] | ||
} | ||
}); | ||
this.on('fail', (test, err) => { | ||
if (test.shouldFail) { | ||
this.failures--; | ||
if (this.stats) { | ||
this.stats.expectedFailures = this.stats.expectedFailures || 0; | ||
this.stats.expectedFailures++; | ||
this.stats.failures--; | ||
this.on('pass', (test) => { | ||
if (test.shouldFail) { | ||
this.failures++; | ||
if (this.stats) { | ||
this.stats.unexpectedPasses = this.stats.unexpectedPasses || 0; | ||
this.stats.unexpectedPasses++; | ||
this.stats.passes--; | ||
} | ||
this.tests.unexpectedPasses.push(test); | ||
} | ||
this.tests.expectedFails.push(test); | ||
} else { | ||
this.tests.unexpectedFails.push(test); | ||
} | ||
}); | ||
this.on('pending', (test) => { | ||
this.tests.pending.push(test); | ||
}); | ||
}); | ||
this.on('fail', (test, err) => { | ||
if (test.shouldFail) { | ||
this.failures--; | ||
if (this.stats) { | ||
this.stats.expectedFailures = this.stats.expectedFailures || 0; | ||
this.stats.expectedFailures++; | ||
this.stats.failures--; | ||
} | ||
this.tests.expectedFails.push(test); | ||
} else { | ||
this.tests.unexpectedFails.push(test); | ||
} | ||
}); | ||
this.on('pending', (test) => { | ||
this.tests.pending.push(test); | ||
}); | ||
} | ||
return grep.apply(this, arguments); | ||
} |
14645
328
14