forked from npm/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ls: Add support for --only={prod[uction]|dev[elopment]}
PR-URL: npm/npm#9024
- Loading branch information
Showing
2 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,24 @@ test('npm ls --dev', function (t) { | |
}) | ||
}) | ||
|
||
test('npm ls --only=development', function (t) { | ||
common.npm(['ls', '--only=development'], EXEC_OPTS, function (er, code, stdout) { | ||
t.ifError(er, 'ls --only=development ran without issue') | ||
t.equal(code, 0) | ||
t.has(stdout, /(empty)/, 'output contains (empty)') | ||
t.end() | ||
}) | ||
}) | ||
|
||
test('npm ls --only=dev', function (t) { | ||
common.npm(['ls', '--only=dev'], EXEC_OPTS, function (er, code, stdout) { | ||
t.ifError(er, 'ls --only=dev ran without issue') | ||
t.equal(code, 0) | ||
t.has(stdout, /(empty)/, 'output contains (empty)') | ||
t.end() | ||
}) | ||
}) | ||
|
||
test('npm ls --production', function (t) { | ||
common.npm(['ls', '--production'], EXEC_OPTS, function (er, code, stdout) { | ||
t.ifError(er, 'ls --production ran without issue') | ||
|
@@ -80,6 +98,32 @@ test('npm ls --prod', function (t) { | |
}) | ||
}) | ||
|
||
test('npm ls --only=production', function (t) { | ||
common.npm(['ls', '--only=production'], EXEC_OPTS, function (er, code, stdout) { | ||
t.ifError(er, 'ls --only=production ran without issue') | ||
t.notOk(code, 'npm exited ok') | ||
t.has( | ||
stdout, | ||
/test-package-with-one-dep@0\.0\.0/, | ||
'output contains [email protected]' | ||
) | ||
t.end() | ||
}) | ||
}) | ||
|
||
test('npm ls --only=prod', function (t) { | ||
common.npm(['ls', '--only=prod'], EXEC_OPTS, function (er, code, stdout) { | ||
t.ifError(er, 'ls --only=prod ran without issue') | ||
t.notOk(code, 'npm exited ok') | ||
t.has( | ||
stdout, | ||
/test-package-with-one-dep@0\.0\.0/, | ||
'output contains [email protected]' | ||
) | ||
t.end() | ||
}) | ||
}) | ||
|
||
test('cleanup', function (t) { | ||
cleanup() | ||
t.end() | ||
|