253 Commits

Author SHA1 Message Date
Nate Fischer
35016ce1e7 test: add misc. tests to improve coverage (#673)
No change in production logic.

This adds missing tests to improve test coverage. This does not change
ShellJS behavior at all--all test cases are testing already-working
functionality.

One test case has been renamed for clarity.

For the "omit directory if missing recursive flag" case, we were
actually already testing that in another case, but we were testing
multiple things in that test case. It's better to test this one error
condition explicitly in its own case.

When adding real tests for `parseOptions()`, we need to explicitly clear
`common.state.error` because we're testing an internal function, not a
wrapped command.

Partial fix for #671
2017-03-05 02:28:47 -08:00
Fran Dios
172d0f1543 Modified glob pattern. Fixes #666 (#676) 2017-02-28 17:32:02 -08:00
Fran Dios
df06ac4a8a ls -L (follow symlinks) (#665)
* feat: -L (follow symlinks) option for ls

* test: ls -L option

* docs: Add ls -L option to readme

* fix: ls -L ternary operator

* Revert "test: ls -L option"

This reverts commit dbb057ac087b23aa2c1358018d3c832dd546c5f2.

* test: ls -L option

* test: Remove duplicate test
2017-02-27 20:53:32 -08:00
Stanislav Termosa
8dd2488ec5 feature: add -a option for which command (#655)
* feature: add -a option for which command

* chore(test): test which -a with unexisting name

* chore(test): check which -a has same result as regular one

* chord(test): fix errors mentioned by eslint
2017-02-10 10:32:22 -08:00
Brandon Freitag
055156f7f5 Fix find ENOENT (#654)
* Add find: nonexistant path test

* Catch statSync errors, return shell error
2017-02-02 15:21:58 -08:00
Nate Fischer
4c48631d74 refactor: create common.execPath (#636)
Switch to using common.execPath instead of process.execPath directly and warn
electron users if we were unable to find the correct path to NodeJS.
2017-01-08 13:52:39 -08:00
Nate Fischer
ac0ff873f1 refactor: add config.reset() and .resetForTesting() (#641)
Add .reset() and .resetForTesting() to shell.config and use .resetForTesting()
as a standard set-up for unit tests.
2017-01-07 22:40:38 -08:00
Nate Fischer
2da9ab55be fix: allow non-normalized paths as input to mkdir (#635)
Adds tests to make sure that non-normalized paths (i.e. path/to/./dir) are
valid for a few commands, including mkdir() which previously failed when given
the -p flag.

Fixes #634
2017-01-07 18:06:15 -08: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
c95d331be0 test: refactor shjs tests to AVA (#625) 2016-12-20 00:12:59 -08:00
Nate Fischer
63041b74d6 test: refactor pushd tests to AVA (#627) 2016-12-19 22:51:54 -08:00
Nate Fischer
057a8c89fc test: refactor popd tests to AVA (#626) 2016-12-19 22:48:11 -08:00
Nate Fischer
51fea9b7f0 test: refactor global tests to AVA (#605) 2016-12-14 13:57:40 -08:00
Nate Fischer
1ed8a173e1 test: remove tests for make (deprecated) (#624) 2016-12-14 07:09:09 -08:00
Nate Fischer
b26284a319 test: refactor ls to use AVA (#609) 2016-12-13 21:13:41 -08:00
Nate Fischer
5bd6ac8896 test: refactor sed tests to AVA (#607) 2016-12-09 10:27:02 -08:00
Nate Fischer
0bb686d758 test: refactor touch tests to AVA (#604) 2016-12-09 10:26:52 -08:00
Nate Fischer
4c82369690 test: refactor mkdir tests to AVA (#599) 2016-12-09 10:26:43 -08:00
Nate Fischer
6f26d52eab test: refactor ln tests to AVA (#610) 2016-12-09 01:25:10 -08:00
Nate Fischer
a7ca4d6a8a test: refactor grep tests to AVA (#606) 2016-12-08 23:19:42 -08:00
Nate Fischer
94d65a32f8 test: refactor uniq tests to AVA (#603) 2016-12-08 23:13:00 -08:00
Nate Fischer
40273b73c4 test: refactor 'test' command tests to AVA (#612) 2016-12-08 22:10:58 -08:00
Nate Fischer
c3811f7e66 test: refactor find tests to AVA (#611) 2016-12-08 21:47:08 -08:00
Nate Fischer
f06c5845e9 test: refactor pipe tests to AVA (#608) 2016-12-08 21:36:49 -08:00
Nate Fischer
66fa1048aa test: refactor sort tests to AVA (#602) 2016-12-08 21:36:22 -08:00
Nate Fischer
ef68bd32af test: refactor tail tests to AVA (#601) 2016-12-08 21:36:09 -08:00
Nate Fischer
1cdb051876 test: refactor head tests to AVA (#600) 2016-12-08 21:35:53 -08:00
Nate Fischer
c51abffc5c test: refactor mv tests to AVA (#597) 2016-12-08 21:35:39 -08:00
Nate Fischer
947e47ebb6 test: refactor pwd tests to AVA (#582) 2016-12-08 20:14:44 -08:00
Nate Fischer
6b15577541 test: refactor exec tests to AVA (#574)
* test: refactor exec tests to AVA

* change single quotes to double quotes for Win
2016-11-30 21:14:49 -08:00
Nate Fischer
b0d00ea031 test: refactor set tests to AVA (#576) 2016-11-27 13:14:04 -08:00
Nate Fischer
a8b5933545 test: refactor which tests to AVA (#580) 2016-11-27 11:48:40 -08:00
Nate Fischer
00dd0f6641 test: refactor plugin tests to AVA (#579) 2016-11-27 11:48:18 -08:00
Nate Fischer
c78eecdff0 test: refactor tempdir tests to AVA (#581) 2016-11-25 11:03:05 -08:00
Nate Fischer
f225f35dda test: refactor rm tests to AVA (#586) 2016-11-25 10:59:17 -08:00
Nate Fischer
e52caa5e25 test: refactor echo tests to AVA (#575) 2016-11-25 10:58:42 -08:00
Nate Fischer
2f3aea3643 test: refactor env tests to AVA (#573) 2016-11-24 03:06:33 -08:00
Nate Fischer
49b7dbd7a2 test: refactor toEnd tests to AVA (#578) 2016-11-24 01:29:14 -08:00
Nate Fischer
895bbf3ae6 test: refactor dirs tests to AVA (#572) 2016-11-23 23:11:26 -08:00
Nate Fischer
f92407e032 test: refactor common tests to AVA (#570) 2016-11-23 23:09:53 -08:00
Nate Fischer
2d1d68e9ea test: refactor chmod tests to AVA (#569) 2016-11-23 23:09:30 -08:00
Nate Fischer
612e51b897 test: refactor to tests to AVA (#577) 2016-11-23 23:05:08 -08:00
Nate Fischer
106e05fc45 test: refactor config tests to AVA (#571) 2016-11-23 22:38:46 -08:00
Nate Fischer
d9e3008c85 test: refactor cp tests to ava (#565)
* test: refactor cp tests to ava

* refactor: use `utils.` syntax for utilities
2016-11-20 13:11:32 -08:00
Nate Fischer
0743004717 test: refactor cat tests to ava (#564)
* test: refactor cat tests to ava

* refactor: only set config.silent once
2016-11-20 13:10:58 -08:00
Nate Fischer
81e2803c45 test: set up ava and move cd.js (#561)
* test: set up ava and move cd.js

Set up ava as the new test framework. Migrate the tests for the cd command to
use the ava framework.

* refactor: reorder imports, remove useless dep
2016-11-18 19:50:36 -08:00
Nate Fischer
7a82946a8d fix: maxdepth doesn't limit total number of copies (#549)
* fix: maxdepth doesn't limit total number of copies

Prevent maxdepth from limiting the total number of copies, only allow it to
limit the maximum depth

Fixes #547

* refactor: make `depth` be its own argument
2016-11-10 00:18:04 -08:00
Nathan Phillip Brink
3bc0852702 Get pipe tests running on Windows. (#550)
* Get pipe tests running on Windows.

I used the FIND command which ships with Windows as something to
pass data through.

The test checks that a POSIX-like find(1) exists and skips the tests
if this condition is true because Windows-provided FIND is incompatible
with find(1).

* Remove obvious comments.

Requested by @nfischer. I removed both the unix-specific and Windows
specific comments because I figure they both fall under being too
obvious based on being in the process.platform conditional.

* Make FIND usage cleaner and document it.

* Use shx grep to make pipe tests portable.

Discussed in #550. To test piping and its interaction with
real processes, a shellout is necessary. But on Windows,
you cannot rely on utilities like grep(1) being around.
Using shx, we can write portable code. Otherwise, the
tests have to be conditional on the platform and be
way more complicated.
2016-11-08 20:51:06 -08:00
Nate Fischer
4975b54a4f feat: plugin.error() takes an options parameter (#535)
This implements the following options: `continue`, `code`, `prefix`, & `silent`.

Fixes #522, #523
2016-10-23 23:17:42 -07:00
Gyandeep Singh
93ea025755 Revert "refactor: replace fs.existsSync" (fixes #531) (#532)
This reverts commit ab8cf5a8e027b28fc7b784587e4339d2b6d0f08f.
2016-10-17 20:14:43 -07:00