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:
-rw-r--r--lib/ls.js6
-rw-r--r--tap-snapshots/test-lib-ls.js-TAP.test.js14
-rw-r--r--test/lib/ls.js2
3 files changed, 14 insertions, 8 deletions
diff --git a/lib/ls.js b/lib/ls.js
index 939bdd132..56bb4faec 100644
--- a/lib/ls.js
+++ b/lib/ls.js
@@ -123,7 +123,11 @@ const getHumanOutputItem = (node, { args, color, global, long }) => {
: ''
) +
`${highlightDepName ? chalk.yellow.bgBlack(printable) : printable}` +
- (node[_dedupe] ? ' deduped' : '') +
+ (
+ node[_dedupe]
+ ? (color ? chalk.gray(' deduped') : ' deduped')
+ : ''
+ ) +
(
node[_invalid]
? (color ? chalk.red.bgBlack(' invalid') : ' invalid')
diff --git a/tap-snapshots/test-lib-ls.js-TAP.test.js b/tap-snapshots/test-lib-ls.js-TAP.test.js
index dd2dd73a1..0725b469d 100644
--- a/tap-snapshots/test-lib-ls.js-TAP.test.js
+++ b/tap-snapshots/test-lib-ls.js-TAP.test.js
@@ -455,13 +455,13 @@ test-npm-ls@1.0.0 {CWD}/ls-ls-using-aliases
`
exports[`test/lib/ls.js TAP ls with args and dedupe entries > should print tree output containing deduped ref 1`] = `
-dedupe-entries@1.0.0 {CWD}/ls-ls-with-args-and-dedupe-entries
-+-- @npmcli/a@1.0.0
-| \`-- @npmcli/b@1.1.2 deduped
-+-- @npmcli/b@1.1.2
-\`-- @npmcli/c@1.0.0
- \`-- @npmcli/b@1.1.2 deduped
-
+dedupe-entries@1.0.0 {CWD}/ls-ls-with-args-and-dedupe-entries
++-- @npmcli/a@1.0.0
+| \`-- @npmcli/b@1.1.2 deduped
++-- @npmcli/b@1.1.2
+\`-- @npmcli/c@1.0.0
+ \`-- @npmcli/b@1.1.2 deduped
+
`
exports[`test/lib/ls.js TAP ls with args and different order of items > should print tree output containing deduped ref 1`] = `
diff --git a/test/lib/ls.js b/test/lib/ls.js
index e1b24990c..c5068b4f8 100644
--- a/test/lib/ls.js
+++ b/test/lib/ls.js
@@ -905,6 +905,7 @@ test('ls', (t) => {
})
t.test('with args and dedupe entries', (t) => {
+ _flatOptions.color = true
prefix = t.testdir({
'package.json': JSON.stringify({
name: 'dedupe-entries',
@@ -947,6 +948,7 @@ test('ls', (t) => {
ls(['@npmcli/b'], (err) => {
t.ifError(err, 'npm ls')
t.matchSnapshot(redactCwd(result), 'should print tree output containing deduped ref')
+ _flatOptions.color = false
t.end()
})
})