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
diff options
context:
space:
mode:
authorRuy Adorno <ruyadorno@hotmail.com>2021-01-15 23:14:24 +0300
committerRuy Adorno <ruyadorno@hotmail.com>2021-01-15 23:47:25 +0300
commit358e223f208774f9f3bfd7ac50785598ac998ea2 (patch)
tree0579212baaffd2b596e6d25b88c59513f7dbad24
parentd6456c8ebb6d7a832d508eadc100094b547fa36c (diff)
fix: npm ls global tests
-rw-r--r--lib/ls.js2
-rw-r--r--test/lib/ls.js1
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/ls.js b/lib/ls.js
index 362dacad3..153759d83 100644
--- a/lib/ls.js
+++ b/lib/ls.js
@@ -99,7 +99,7 @@ const getHumanOutputItem = (node, { args, color, global, long }) => {
// special formatting for top-level package name
if (node.isRoot) {
const hasNoPackageJson = !Object.keys(node.package).length
- if (hasNoPackageJson)
+ if (hasNoPackageJson || global)
printable = path
else
printable += `${long ? EOL : ' '}${path}`
diff --git a/test/lib/ls.js b/test/lib/ls.js
index 7bbfc5f77..a9504a2ad 100644
--- a/test/lib/ls.js
+++ b/test/lib/ls.js
@@ -3795,6 +3795,7 @@ t.test('ls --json', (t) => {
t.deepEqual(
jsonParse(result),
{
+ name: 'ls-ls-json-global',
dependencies: {
a: {
version: '1.0.0',