Skip to content
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.

Support for command that return non-zero exit status #251

Open
onknows opened this issue Jan 10, 2018 · 3 comments
Open

Support for command that return non-zero exit status #251

onknows opened this issue Jan 10, 2018 · 3 comments

Comments

@onknows
Copy link

onknows commented Jan 10, 2018

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.

@tsikerdekis
Copy link

Perhaps an override command could be added to ignore exit statuses?

@trnubo
Copy link

trnubo commented Mar 22, 2018

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

@Potherca
Copy link

This project is no longer being actively maintained by its original auther (see #236).

You might want to migrate to the community maintained fork bats-core and report your issue there.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants