Feature request: --continue-on-error, BUT it returns a failing error code if any command fails
DanKaplanSES opened this issue · comments
Here's my use case:
I use npm-run-all to run my tests which are a little slow (15 seconds). For that reason, I'm using your tool to give me a notification pop-up when tests are done, regardless of the results.
The command looks like this: unit-test: npm-run-all actual-unit-test notify.sh --continue-on-error
.
This works fine, but sometimes I'm annoyed that I have to check to see if they pass or failed. What I'd like to do is run a chain of commands, and at the end of it change the notification depending on the exit code (e.g. a green notification if it passed, a red on failure). That way, no matter what I'm doing on my computer, I can see at a glance whether I can continue coding or if I need to read what failed.
Because --continue-on-error
always returns an exit code of 0, I don't know how to "tell" notify.sh
if the tests passed. I'm not a commandline expert, per se, but based on my knowledge, it seems like I can either use your tool so I get notifications regardless of the outcome, OR I stop using npm-run-all and chain my npm scripts with || notify.sh
at the end.
This could be done with a bash script, but considering I have npm scripts for acceptance tests that call npm scripts for unit tests -- and some AI driven tests -- I'd rather not have to write that bash script myself.
Full disclosure: I'm extremely exhausted right now. I hope this request makes sense, and I wouldn't be surprised if there's an obvious solution to this problem I'm not seeing. Thanks!
The --continue-on-error
documentation suggests it already does what you want:
Set the flag to continue executing
other/subsequent tasks even if a task threw an
error. 'npm-run-all' itself will exit with
non-zero code if one or more tasks threw error(s)
However, I’m seeing a zero exit code even when one of the bundled commands fails, so I’m puzzled 🤔
That turned out to be because some of the bundled commands included cd -
which was masking the actual error!