diff options
-rw-r--r-- | lib/ls.js | 2 | ||||
-rw-r--r-- | test/tap/ls-depth-cli.js | 44 |
2 files changed, 45 insertions, 1 deletions
@@ -434,7 +434,7 @@ function getExtras (data) { function makeParseable (data, long, dir, depth, parent, d) { depth = depth || 0 - + if (depth > npm.config.get('depth')) return [ makeParseable_(data, long, dir, depth, parent, d) ] return [ makeParseable_(data, long, dir, depth, parent, d) ] .concat(Object.keys(data.dependencies || {}) .sort(alphasort).map(function (d) { diff --git a/test/tap/ls-depth-cli.js b/test/tap/ls-depth-cli.js index 760681427..87eafced2 100644 --- a/test/tap/ls-depth-cli.js +++ b/test/tap/ls-depth-cli.js @@ -159,6 +159,50 @@ test('npm ls --depth=Infinity --json', function (t) { ) }) +test('npm ls --depth=0 --parseable --long', function (t) { + common.npm( + ['ls', '--depth=0', '--parseable', '--long'], + EXEC_OPTS, + function (er, c, out) { + t.ifError(er, 'npm ls ran without issue') + t.equal(c, 0, 'ls ran without raising error code') + t.has( + out, + /.*test-package-with-one-dep@0\.0\.0/, + 'output contains test-package-with-one-dep' + ) + t.doesNotHave( + out, + /.*test-package@0\.0\.0/, + 'output not contains test-package' + ) + t.end() + } + ) +}) + +test('npm ls --depth=1 --parseable --long', function (t) { + common.npm( + ['ls', '--depth=1', '--parseable', '--long'], + EXEC_OPTS, + function (er, c, out) { + t.ifError(er, 'npm ls ran without issue') + t.equal(c, 0, 'ls ran without raising error code') + t.has( + out, + /.*test-package-with-one-dep@0\.0\.0/, + 'output contains test-package-with-one-dep' + ) + t.has( + out, + /.*test-package@0\.0\.0/, + 'output not contains test-package' + ) + t.end() + } + ) +}) + test('cleanup', function (t) { cleanup() t.end() |