Skip to content

Commit

Permalink
[fix] don't consider 'ok' of todo tests in exit code
Browse files Browse the repository at this point in the history
  • Loading branch information
r0mflip authored and ljharb committed May 23, 2019
1 parent 9ec3a0f commit 15b2dfc
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -118,7 +118,7 @@ function createHarness(conf_) {
inspectCode(st_);
});
st.on('result', function (r) {
if (!r.ok && typeof r !== 'string') test._exitCode = 1
if (!r.todo && !r.ok && typeof r !== 'string') test._exitCode = 1
});
})(t);

Expand Down
37 changes: 37 additions & 0 deletions test/todo_single.js
@@ -0,0 +1,37 @@
var tap = require('tap');
var tape = require('../');
var concat = require('concat-stream');

var common = require('./common');
var stripFullStack = common.stripFullStack;

tap.test('tape todo test', function (assert) {
var test = tape.createHarness({ exit: false });
assert.plan(1);

test.createStream().pipe(concat(function (body) {
assert.equal(
stripFullStack(body.toString('utf8')),
'TAP version 13\n'
+ '# failure\n'
+ 'not ok 1 should be equal # TODO\n'
+ ' ---\n'
+ ' operator: equal\n'
+ ' expected: false\n'
+ ' actual: true\n'
+ ' at: Test.<anonymous> ($TEST/todo_single.js:$LINE:$COL)\n'
+ ' ...\n'
+ '\n'
+ '1..1\n'
+ '# tests 1\n'
+ '# pass 1\n'
+ '\n'
+ '# ok\n'
)
}));

test('failure', { todo: true }, function (t) {
t.equal(true, false);
t.end();
});
});

0 comments on commit 15b2dfc

Please sign in to comment.