Skip to content

Commit

Permalink
nuUnit should have non-zero exit code when _any_ test fails
Browse files Browse the repository at this point in the history
  • Loading branch information
NonlinearFruit committed May 17, 2024
1 parent 67fa2a9 commit be6fc9c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion nuunit.nu
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export def main [

$testResults
| get exit_code
| sort
| sort --reverse
| get -i 0
| default 0
| exit $in
Expand Down
1 change: 0 additions & 1 deletion test-spec.nu
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export def "test handles when spec does not exist" [] {
}

export def "test exit with error when test errors" [] {
use tests/test-spec-that-errs.nu "verify json results"
let specFile = "tests/test-spec-that-errs.nu"

do {
Expand Down
10 changes: 9 additions & 1 deletion tests/test-spec-that-errs.nu
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,19 @@ export def "test that is broken" [] {
error make { msg: "It broke!" }
}

export def "test after broken test that is fine" [] {
"Bug where nuunit only exits with
error when the _last_ test errs.
This test passes after the failure
above to make sure nuunit err when
any test errs"
}

export def "verify json results" [] {
let results = $in
use std assert

assert equal 1 ($results | length)
assert equal 2 ($results | length)
assert not equal 0 ($results.exit_code)
assert not equal "" ($results.stderr)
}

0 comments on commit be6fc9c

Please sign in to comment.