-
Notifications
You must be signed in to change notification settings - Fork 441
Description
Describe the bug
Hi,
i'm running some coverage test with bats and bashcov. By default, bashcov sets the SHELLOPTS
environment variable to xtrace
. This implicit enables nounset
on the whole bats run, too. All errors are reproducible by having an empty SHELLOPTS
variables defined. Thats the reason, why I'm report many unbound error in history.
Since I'm trying to integrate the setup_suite
method on my current tests, I'm getting a unbound error
core/lib/bats-core/tracing.bash: line 19: BATS_TEST_NAME: unbound variable
by adding an empty setup_suite
function on setup_suite.bash
. In case, setup_suite.bash
contains syntax errors, I'm getting
core/libexec/bats-core/bats-exec-suite: line 275: BATS_SETUP_SUITE_COMPLETED: unbound variable
On MacOS, there is always an additional error:
core/libexec/bats-core/bats-exec-suite: line 283: stack_trace[@]: unbound variable
To Reproduce
Steps to reproduce the behavior:
- Create a load.bash file inside test directory
- Create a setup_suite.bash inside the test directory:
setup_suite() { true }
- Run test suite with
--tap
andenv SHELLOPTS=""
, e.g.env SHELLOPTS="" bats --tap -r tests
- See error
1..1 /work/tests/bats/core/lib/bats-core/tracing.bash: line 19: BATS_TEST_NAME: unbound variable not ok 1 setup_suite
Expected behavior
A clear and concise description of what you expected to happen.
Environment (please complete the following information):
- Bats Version [e.g. 1.4.0 or commit hash] c97b3a1
- OS: [e.g. Linux, FreeBSD, MacOS] Linux / MacOS
- Bash version: [e.g. 5.1] 5.0.17(1)-release / 3.2.57(1)-release
Additional context
All error only appears, if a setup_suite.bash
with a setup_suite
function exists and SHELLOPTS is set.