Skip to content

Commit

Permalink
show not ok messages in the final output
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Dec 26, 2013
1 parent 654d6c2 commit 5c56275
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
10 changes: 7 additions & 3 deletions example/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function getMessage () {
return msgs[Math.floor(Math.random() * msgs.length)];
}

test('beep', function (t) {
test('beep affirmative', function (t) {
t.plan(24);
var i = 0, n = 0;
var iv = setInterval(function () {
Expand All @@ -13,11 +13,15 @@ test('beep', function (t) {
}, 50);
});

test('boop', function (t) {
test('boop exterminate', function (t) {
t.plan(20);
var i = 0, n = 0;
var iv = setInterval(function () {
t.equal(i++, n++, getMessage());
if (i % 7 === 0) {
t.equal(i, n + 6, getMessage())
}
else t.equal(i, n, getMessage());
i++; n++;
if (i === 20) clearInterval(iv);
}, 100);
});
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ module.exports = function (opts) {

tap.on('comment', function (comment) {
test = { name: comment, assertions: [] };
out.push(replaceLine(comment) + '\n');
out.push(replaceLine('# ' + comment) + '\n');
});

tap.on('assert', function (res) {
var ok = res.ok ? ' ok' : ' not ok';
var fmt = '%s %3d %s';
var fmt = '%s %2d %s';
if (!res.ok) fmt += '\n';
var str = sprintf(fmt, ok, res.number, res.name);
out.push(replaceLine(str));
test.assertions.push(res);
Expand Down

0 comments on commit 5c56275

Please sign in to comment.