exit on first failure?
Opened this issue · 5 comments
michaelshobbs commented
I haven't been able to find documentation on this yet (hopefully I just overlooked it) but I'd like to have bats
exit on first failure when being invoked as bats /path/to/tests/*.bats
.
Is this possible?
ztombol commented
Bats can't do this yet. Though, adding the option would be certainly useful.
michaelshobbs commented
This really blows that bats can't do this. I'm willing to do the work if someone could point me in the right direction.
vincentbernat commented
Here is a workaround:
#!/usr/bin/env bats
setup() {
[ ! -f ${BATS_PARENT_TMPNAME}.skip ] || skip "skip remaining tests"
}
@test "foo" {
true
}
@test "foo2" {
false
}
@test "foo3" {
true
}
teardown() {
[ -n "$BATS_TEST_COMPLETED" ] || touch ${BATS_PARENT_TMPNAME}.skip
}
michaelshobbs commented
Excellent! Thank you.
carlosonunez commented
Wow; what a simple solution. Here I was killing the parent process and having a tough time of it.
Thank you!