This adds test coverage for the shell.exit() function. This also
refactors how we mock stdout/stderr and adds support for mocking
process.exit() (which was needed for this change).
While I was writing these tests, I realized there was an edge case I
missed in PR #1122. This change fixes that edge case.
Issue #1013
* Added `-q` (quiet) option to `push`, `popd`, `dirs` functions.
* Added unit tests for pushd/popd quiet mode.
* Added tests for `pushd` and `popd` with quiet mode off.
* Updated docs for `pushd` and `popd` functions.
* Moved preliminary `pushd` commands for `popd` tests before disabling of silent flag.
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.
* fix: convert error output to be consistent cross-platform
The error output produced by `shell.error()` or `result.stderr` should
not be inconsistent between platforms. This ensures that path separators
are always printed by ShellJS as `/` instead of as `\` on Windows. This
should allow scripts using ShellJS to be more consistent cross-platform.
We were not previously relying on error output to always be consistent--
only checking its truthiness. Since this was not part of our tested API,
it should be reasonable to change this and release in a patch.
Fixes#681
* Fix broken pushd test case
* Fix TODO in a test case
Plenty of errors surfaced with better test coverage. Aside from fixing
the broken implementations, this also prompted me to fully implement
the dirs command.
Also changed the run-tests script to always set cwd to the test folder,
so that tests that change cwd don't affect others (ehum, that'd be
mine.)
More tests to follow.