21 Commits

Author SHA1 Message Date
Nate Fischer
1a31356343 refactor: use require instead of import
No change to logic. This swaps over tests to use require() since
everything is currently designed for the commonjs module system.
2025-04-07 22:44:24 -07:00
Nate Fischer
39ebb71846 test: add coverage for exit function
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
2023-11-11 18:27:54 -08:00
Nate Fischer
6d66a1af98
chore: rename some tests (#871)
No change to logic.

This renames some tests to be a bit more readable.
2018-07-11 15:06:20 -07:00
Brandon Freitag
e8ec60bc2f Echo test mocks (#708)
* Add stdout/stderr test mocks

* Mock stdout/stderr during echo tests

* Fix lint issues

* Use 'use strict'

* Re-implement mocks as a prototype

* Implement mocks as a single-instance

* Remove redundant test

* Create mocked stdout/stderr.write methods once
2017-06-06 21:10:27 -07:00
Nate Fischer
18034486a5 Echo stdout (#677)
* Add newline to output of echo (#557)

* Add newline to output of echo

* Add test

* Throw an error if the options string does not start with '-' (#615)

* Throw an error if the options string does not start with '-'

* Add test

* Change message grammar

* Add -n option to echo

* Fix null argument issue

* Add -n tests

* Add documentation

* Add -en escaped character test

* Add function to parse options for echo

* Use parseOptions to parse echo options

* Simplify control flow

* parseOptions throws now

* Allow null to be echoed

* Prevent echo stderr on unrecognized option

* Add test to check stderr of returned value

* Use consistent variable name

* Change test message, leave TODO about console output
2017-06-06 21:10:27 -07:00
Brandon Freitag
5acb353bc5 Add newline to output of echo (#557)
* Add newline to output of echo

* Add test
2017-06-06 21:10:27 -07:00
Brandon Freitag
7fa4b995bf Finalize moving to ava (#630)
* Move ava-test/ directory to test/

* Remove unnecessary run-tests.js script

* Run only ava during npm test script
2016-12-20 11:27:02 -08:00
Nate Fischer
e52caa5e25 test: refactor echo tests to AVA (#575) 2016-11-25 10:58:42 -08:00
Nate Fischer
45f719de75 fix: echo supports -e option properly (#511) 2016-08-23 19:36:05 -07:00
Nate Fischer
2395214fee chore: switch to eslint (#504)
* chore: switch to eslint

* fix: works on older versions of NodeJS now

* chore: fix curly braces

* chore: fix indents and remove jshint references
2016-08-07 12:16:29 -07:00
Nate Fischer
2fa739e3f1 fix: null is no longer confused for an object
This is an issue in the case of `echo(which('fakecmd'))`. This used to succeed
in v0.6 but was broken during the ShellString refactor.
2016-04-20 15:20:05 -07:00
Nate Fischer
db20acebfb Switch to process.execPath over 'node' 2016-03-10 17:06:32 -08:00
Nate Fischer
6ebc2d3db7 refactor(shellstring): return consistent objects
- fix(string): no longer overrides string prototype
 - exec() now returns a ShellString object
2016-02-19 14:54:30 -08:00
Artur Adib
193968a978 remove old shims 2013-09-21 10:19:38 -04:00
Artur Adib
21f721cb45 more stringent jshint; catch leaks/undefs 2013-09-21 10:12:28 -04:00
Artur Adib
ef795af7e4 adding jshint to tests; all tests pass 2012-12-27 16:32:31 -05:00
Artur Adib
e4d9dabe52 introducing config.silent, config.fatal
deprecates silent()
2012-12-01 09:48:23 -05:00
Artur Adib
4f710c6b55 fixed echo() dash bug 2012-08-25 15:00:18 -04:00
Artur Adib
2f3bce71d1 echo() overrides silent() 2012-03-27 18:51:02 -04:00
Artur Adib
11614fd516 Deprecated: verbose() and exists() 2012-03-15 14:20:10 -04:00
Artur Adib
35c0bdf8cc echo(), to() 2012-03-02 09:50:25 -05:00