Unconditionally apply `silent: true` when calling `common.error()` from
`exec()`. This is because errors are already printed to stderr, or are
intentionally silenced by `shell.config.silent`.
Based on #861Fixes#851
* Remove separate "internal error" from exec
* Fix unknown command error regex
* Add message about command not found regex
* Silence errors while reading files in exec
The stdout and stderr files may never be opened or written to in certain
circumstances. In particular, if the timeout is short enough, the child
node process does not have enough time to start, and the child script
does not execute, so the files are not written to. So, catch errors form
trying to read the files, and ignore them.
* Do not silence errors due to short timeouts
* Simplify test regex for missing command
* Default error code to 1 if not set
This PR refactors `shell.exec()` by putting its child process in a separate code
file. This also slightly cleans up dead code.
There's more potential to clean this up (e.g. exit status), but this is a good
enough start.
Issue #782
This updates tests for `AVA` 19.0.0+.
`AVA` 0.18.0 has a breaking change which changes the current working directory
for tests. As a result, we need to change 'resources' -> 'test/resources' (and
similar path changes).
`AVA` 0.19.0 has a breaking change that all tests must run at least one assert.
This breaking change was already resolved by #746, so no change was necessary in
this PR.
This updates to `AVA` 0.21.0, since there are no other breaking changes.
This adds `skipOnWin` and `skipOnUnix` to help us manage our platform-dependent
tests. These methods give a nice warning message when we skip tests. We may also
consider adding warnings when running platform-dependent tests.
Part of the motivation for this is if we ever update to AVA v0.19. This version
requires at least one assertion per test case. While this could be disabled with
an AVA setting, we instead benefit from warnings for any case when we
unintentionally skip assertions.
This adds chalk as a dev dependency to enable colored messages.
* test(exec): add tests for coverage
No logic change.
This adds one test to cover some missing lines, and adds some `istanbul ignore`
directives.
I see 100% line coverage for `src/exec.js` when running:
```sh
$ nyc --reporter=text --reporter=lcov ava --serial test/exec.js`
```
Fixes#742
* Fix lint