-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Forgotten set -e
when run <my_function>
#719
Comments
set -e
in run <my_function>
set -e
when run <my_function>
The documentation says that The I think we could allow run to not do this but changing the default behavior would likely break existing code. |
Maybe you should add a command line flag, or introduce a new |
|
I tried to implement this but I quickly realised that |
@martin-schulze-vireso Can you possibly tell where/how |
Yes, here: bats-core/lib/bats-core/test_functions.bash Line 368 in e9fd17a
You can provide your own wrapper function that would
However, be warned that this could interfere with |
@x-yuri Does the code snippet above work for you? I think it does more or less the same as #815 and #748. It didn't work for me on bats c041f32 with bash 5.0 (see my previous comment in this issue above). @martin-schulze-vireso would you like to try it and see if we missed anything? |
Oh boy, that's what you get for just working off the top of your head. I just tried my own code and as you said it does not work. bats-core/lib/bats-core/test_functions.bash Line 378 in e9fd17a
bats-core/lib/bats-core/test_functions.bash Line 383 in e9fd17a
These boolean operations suppress the errexit. I think I put them there to prepare removing UPDATE
A test started to fail. I cannot really pinpoint it yet, but the |
Describe the bug
The
run
changed resets theset -e
that change the behaviors of the function.To Reproduce
set -e
is not set as the source :Expected behavior
The sourced
set
flags have to be set under testing too.Environment (please complete the following information):
Additional context
I use
run
to have$status
and$output
.I have read the https://bats-core.readthedocs.io/en/stable/writing-tests.html#when-not-to-use-run part of the documentation, that mentions the code will run with
set -e
in a subshell. This would be right for me, but my function works differently.The text was updated successfully, but these errors were encountered: