672 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
Nate Fischer
346fca4cb6 test: don't count hard-to-test lines for coverage (#672)
No change in logic.

Add `/* istanbul ignore next */` lines for hard-to-test lines so that
they don't count against us during code coverage.

I've also adjusted comments that I found confusing, and changed some
formatting.

Partial fix for #671
2017-03-04 17:54:43 -08:00
Nate Fischer
eb5230a53c chore: add codecov (#682)
* chore: add codecov

Add codecov to ShellJS

Partial fix for #671

* Add codecov badge to README
2017-03-04 17:53:37 -08:00
Nate Fischer
5318fdc43a docs: miscellaneous README changes (#661)
- Add @freitagbr to the bottom of the README
 - Remove docs about shjs (it's not well supported)
 - Remove docs about coffeescript (we don't do anything special for
   coffeescript anyway)
 - Modify the section about shelljs/global, since we strongly recommend
   avoiding this now
 - Rewrite the code example to use `require('shelljs')` instead of
   shelljs/global
 - Mention ESLint next to JSHint
 - Reformat sections with long lines to be 80 columns
2017-03-04 01:07:23 -08:00
Nate Fischer
3cd4470be3 refactor: reduce repeated code in which() (#659)
Use path.delimiter instead of explicit conditional. Try to reuse
repeated code blocks.

Fixes #656
2017-03-04 00:14:20 -08:00
Fran Dios
172d0f1543 Modified glob pattern. Fixes #666 (#676) 2017-02-28 17:32:02 -08:00
Nate Fischer
2d0428b1c9 Switch commands.json -> commands.js (#668)
WebPack has issues with importing JSON directly and using JavaScript
methods on it. For this reason, using the `.forEach()` method on the
imported JSON array caused a method-not-found error.

Instead, we can make this a real JavaScript array by keeping it in a
JavaScript file and exporting it as a field.

It should be noted that exporting it as `exports = [...]` does not work,
because Node won't actually interpret it as a JavaScript array (with
the required methods). So instead we can export it as
`exports.list = [...]` and access the `list` field to get the real
JavaScript array of command names.

Fixes #667
2017-02-28 01:34:51 -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
Nate Fischer
006b8c2460 docs: clean up RELEASE.md (#662)
Miscellaneous changes.
2017-02-27 13:23:30 -08:00
George Kalpakas
434ed592de docs(chmod): document options argument (#663) 2017-02-20 15:45:46 -08:00
Faheel Ahmad
fdcc789882 Fix typo (#660)
battled-tested -> battle-tested
2017-02-11 00:17:46 -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
84ffb386eb chore(lint): Enforce a trailing comma for multi-line (#646) 2017-01-16 12:45:14 -08:00
Brandon Freitag
2134bd3da1 docs(release): use bulleted list (#643) 2017-01-13 16:28:04 -08:00
Brandon Freitag
0ff1244a7e docs(changelog): updated by Brandon Freitag [ci skip] 2017-01-08 14:39:40 -08:00
Brandon Freitag
65901129b3 docs(changelog): updated by Brandon Freitag [ci skip] 2017-01-08 14:35:42 -08:00
Brandon Freitag
2e29ba29e6 0.7.6 v0.7.6 2017-01-08 14:28:27 -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
Nate Fischer
a3e622ba0d chore: set up test coverage (#638)
Use nyc for test coverage and ignore all nyc-related files in git & eslint.
This increases testing time (~35sec -> ~60sec on my 4-core machine).
2016-12-27 19:39:13 -08:00
Nate Fischer
2089d3e4b3 docs(changelog): updated by Nate Fischer [ci skip] 2016-12-26 23:36:16 -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
1548b3da00 refactor: list all commands in commands.json (#616)
* refactor: list all commands in commands.json

This also changes the order of commands in the docs, due to how I changed
the doc-generating script.

* fix lint error and alphabetize command list
2016-12-14 17:57: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
Brandon Freitag
927758f714 Ignore test temp directories during linting (#623) 2016-12-14 07:06:15 -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
Brandon Freitag
ded1a3e4a3 Fix: rm behavior regarding symlinks (#598)
* Treat files and symlinks separately

* Remove -f flag from dir symlink test

* Simplify control flow
2016-12-08 23:45:35 -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
ffb1cf3db9 chore: switch to files attribute from npmignore (#613)
Prefer the `files` attribute over `.npmignore` to minimize the bytes users
download when installing ShellJS. This cuts the size down from ~1.8M to ~1.2M.
2016-12-08 22:26:49 -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
Brandon Freitag
76370ed946 Remove files related to lgtm.co (#596) 2016-12-07 21:59:51 -08:00
Brandon Freitag
5ded216dc2 Use Object.assign if possible (#593)
* Fix typo

* Set objectAssign to Object.assign if defined

* Use correct terminology
2016-12-07 12:11:40 -08:00