Open onknows opened 6 years ago
Perhaps an override command could be added to ignore exit statuses?
I'm only new to bats but I think this is already the case
root@1e8afabe18ae:~# cat false.bats
#!/usr/bin/env bats
@test "non-zero exit - false" {
run false
[ ${status} -ne 0 ]
}
@test "non-zero exit - exit 5" {
run exit 5
[ ${status} -eq 5 ]
}
root@1e8afabe18ae:~# bats false.bats
✓ non-zero exit - false
✓ non-zero exit - exit 5
2 tests, 0 failures
root@1e8afabe18ae:~# false; echo $?
1
root@1e8afabe18ae:~# bash -c 'exit 5'; echo $?
5
This project is no longer being actively maintained by its original auther (see https://github.com/sstephenson/bats/issues/236).
You might want to migrate to the community maintained fork bats-core and report your issue there.
I have a command that returns exit status 1. I want to test this but I noticed that Bats expects exit status to be zero. Else it stops executions. This is nice feature to add I think.