Skip to content

Commit

Permalink
Merge pull request #278 from inikulin/master
Browse files Browse the repository at this point in the history
Enable undone tests tracking for the minimal reporter
  • Loading branch information
mreinstein committed Feb 20, 2015
2 parents 60b7d67 + ef6b0c3 commit 222a3c9
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion lib/reporters/minimal.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var nodeunit = require('../nodeunit'),
utils = require('../utils'),
fs = require('fs'),
path = require('path'),
track = require('../track'),
AssertionError = require('assert').AssertionError;

/**
Expand Down Expand Up @@ -52,6 +53,23 @@ exports.run = function (files, options, callback) {

var start = new Date().getTime();

var tracker = track.createTracker(function (tracker) {
if (tracker.unfinished()) {
console.log('');
console.log(bold(red(
'FAILURES: Undone tests (or their setups/teardowns): '
)));
var names = tracker.names();
for (var i = 0; i < names.length; i += 1) {
console.log('- ' + names[i]);
}
console.log('');
console.log('To fix this, make sure all tests call test.done()');
process.reallyExit(tracker.unfinished());
}
});


var opts = {
testspec: options.testspec,
testFullSpec: options.testFullSpec,
Expand All @@ -76,9 +94,12 @@ exports.run = function (files, options, callback) {
}

},
testStart: function () {
testStart: function (name) {
tracker.put(name);
},
testDone: function (name, assertions) {
tracker.remove(name);

if (!assertions.failures()) {
process.stdout.write('.');
}
Expand Down

2 comments on commit 222a3c9

@domenic
Copy link

@domenic domenic commented on 222a3c9 Mar 3, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance of a release with this soon? :)

@mreinstein
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, was hoping for feedback from Caolan sooner. I've published this as 0.9.1

Please sign in to comment.