rylnd / shpec

Test your shell scripts!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

shpec aborts test run early with no error message if 'set -e' used

edmorley opened this issue · comments

STR:

  1. Create a shpec test file that enables bash exit on error (set -e at the top of the file)
  2. Add a test like:
     	it "foo"
     		function_under_test_that_returns_non_zero
     		result=$?
     		assert equal "${result}" 1
     	end
  3. Add some more tests, after that test in the file (they can be anything)
  4. Run the tests

Expected:

shpec runs all tests. Or if bash exit on error isn't supported, then this be documented in the shpec readme.

Actual:

shpec does not run any test after the non-test after step 2 - ie: aborts the test run early. There is no visible error message or failing test output shown, albeit the shpec exit code is non-zero. However when working with shpec locally rather than CI, this non-zero exit code isn't much use - it seems like the tests all passed.