diff options
author | Ruy Adorno <ruyadorno@hotmail.com> | 2020-07-23 17:41:30 +0300 |
---|---|---|
committer | Ruy Adorno <ruyadorno@hotmail.com> | 2020-07-23 17:41:30 +0300 |
commit | 58772965200d1dbaefe4f3211a6d3e8ff5ef8de9 (patch) | |
tree | 92401c157e6b9891d48c4445f4dea11a3a17e628 | |
parent | c891dff3231a06c3fb1d521160e6d700349a584c (diff) |
fix: archy output dedupe label color
-rw-r--r-- | lib/ls.js | 6 | ||||
-rw-r--r-- | tap-snapshots/test-lib-ls.js-TAP.test.js | 14 | ||||
-rw-r--r-- | test/lib/ls.js | 2 |
3 files changed, 14 insertions, 8 deletions
@@ -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 - +[0mdedupe-entries@1.0.0 {CWD}/ls-ls-with-args-and-dedupe-entries[0m +[0m+-- @npmcli/a@1.0.0[0m +[0m| \`-- [33m[40m@npmcli/b@1.1.2[49m[39m[90m deduped[39m[0m +[0m+-- [33m[40m@npmcli/b@1.1.2[49m[39m[0m +[0m\`-- @npmcli/c@1.0.0[0m +[0m \`-- [33m[40m@npmcli/b@1.1.2[49m[39m[90m deduped[39m[0m +[0m[0m ` 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() }) }) |