Skip to content

Commit

Permalink
Don't exist with non-zero code if ALL failures are SKIP or TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
aghassemi committed Jan 20, 2017
1 parent 6cb3345 commit edb16ef
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ function converter(options) {
testCase = newTest('Default');
}

if(!assert.ok) {
exitCode = 1;
}
testCase.asserts.push(assert);
});

Expand Down Expand Up @@ -95,6 +92,9 @@ function converter(options) {
testSuites.forEach(function(suite) {
suite.asserts.forEach(function(a) {
a.skip = a.skip || a.todo;
if (!a.ok && !a.skip) {
exitCode = 1;
}
});
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tap-xunit",
"version": "1.6.0",
"version": "1.7.0",
"description": "TAP to xUnit XML converter.",
"main": "lib/converter.js",
"bin": {
Expand Down
12 changes: 12 additions & 0 deletions test/expected/pass/only-skip-todo-failures
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<testsuites>
<testsuite name="passing-with-skip-todo" tests="3" failures="0" skipped="2" errors="0">
<testcase name="#1 passing"/>
<testcase name="#2 failing but skipped">
<skipped/>
</testcase>
<testcase name="#3 failing but todo">
<skipped/>
</testcase>
</testsuite>
</testsuites>
22 changes: 22 additions & 0 deletions test/input/pass/only-skip-todo-failures
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
TAP version 13
# passing-with-skip-todo
ok 1 passing
not ok 2 failing but skipped # SKIP
---
operator: ok
expected: true
actual: false
at: Test.<anonymous> (/Users/aghassemi/github/tape/test.js:6:5)
...
not ok 3 failing but todo # TODO
---
operator: ok
expected: true
actual: false
at: Test.<anonymous> (/Users/aghassemi/github/tape/test.js:7:5)
...

1..3
# tests 3
# pass 1
# fail 2

0 comments on commit edb16ef

Please sign in to comment.