Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBryan English <bryan@bryanenglish.com>2015-08-01 01:47:34 +0300
committerRebecca Turner <me@re-becca.org>2015-08-12 09:28:38 +0300
commit2cbe412bbe920f6927ca45a8f842d4cbd3525eaf (patch)
treeec4d20293db8c08bc5a4f80a113ac4cd44585265 /test
parent3428611e3b4735fc6d34915a9e86d7bfbd29fd56 (diff)
ls: Add support for --only={prod[uction]|dev[elopment]}
PR-URL: https://github.com/npm/npm/pull/9024
Diffstat (limited to 'test')
-rw-r--r--test/tap/ls-env.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/tap/ls-env.js b/test/tap/ls-env.js
index 30039b5b3..29058d924 100644
--- a/test/tap/ls-env.js
+++ b/test/tap/ls-env.js
@@ -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 test-package-with-one-dep@0.0.0'
+ )
+ 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 test-package-with-one-dep@0.0.0'
+ )
+ t.end()
+ })
+})
+
test('cleanup', function (t) {
cleanup()
t.end()