summaryrefslogtreecommitdiff
path: root/deps/npm/test/lib/utils
diff options
context:
space:
mode:
authornpm team <ops+robot@npmjs.com>2022-02-24 21:41:49 +0000
committerLuigi Pinca <luigipinca@gmail.com>2022-02-26 08:15:26 +0100
commit1b8300b238923822ea0934b196e3a9e97e0a0893 (patch)
tree474bd5d5a4ee73358f4feebd433cc3f67d65b6e2 /deps/npm/test/lib/utils
parente84b635db49d629f119959c9f0a31762ac22770b (diff)
downloadnode-new-1b8300b238923822ea0934b196e3a9e97e0a0893.tar.gz
deps: upgrade npm to 8.5.2
PR-URL: https://github.com/nodejs/node/pull/42122 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Danielle Adams <adamzdanielle@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Diffstat (limited to 'deps/npm/test/lib/utils')
-rw-r--r--deps/npm/test/lib/utils/config/definitions.js9
-rw-r--r--deps/npm/test/lib/utils/exit-handler.js6
-rw-r--r--deps/npm/test/lib/utils/reify-output.js11
-rw-r--r--deps/npm/test/lib/utils/update-notifier.js3
4 files changed, 18 insertions, 11 deletions
diff --git a/deps/npm/test/lib/utils/config/definitions.js b/deps/npm/test/lib/utils/config/definitions.js
index bf4b48709a..a5b34a7499 100644
--- a/deps/npm/test/lib/utils/config/definitions.js
+++ b/deps/npm/test/lib/utils/config/definitions.js
@@ -929,3 +929,12 @@ t.test('lockfile version', t => {
t.match(flat.lockfileVersion, 3, 'flattens to a number')
t.end()
})
+
+t.test('loglevel silent', t => {
+ const flat = {}
+ definitions.loglevel.flatten('loglevel', {
+ loglevel: 'silent',
+ }, flat)
+ t.match(flat.silent, true, 'flattens to assign silent')
+ t.end()
+})
diff --git a/deps/npm/test/lib/utils/exit-handler.js b/deps/npm/test/lib/utils/exit-handler.js
index 54bf48f89b..6a96d92ddb 100644
--- a/deps/npm/test/lib/utils/exit-handler.js
+++ b/deps/npm/test/lib/utils/exit-handler.js
@@ -89,9 +89,9 @@ const mockExitHandler = async (t, { init, load, testdir, config } = {}) => {
...rest,
errors,
npm,
- // // Make it async to make testing ergonomics a little
- // // easier so we dont need to t.plan() every test to
- // // make sure we get process.exit called
+ // Make it async to make testing ergonomics a little
+ // easier so we dont need to t.plan() every test to
+ // make sure we get process.exit called
exitHandler: (...args) => new Promise(resolve => {
process.once('exit', resolve)
exitHandler(...args)
diff --git a/deps/npm/test/lib/utils/reify-output.js b/deps/npm/test/lib/utils/reify-output.js
index 4e9ed7133c..b38a14de33 100644
--- a/deps/npm/test/lib/utils/reify-output.js
+++ b/deps/npm/test/lib/utils/reify-output.js
@@ -1,9 +1,4 @@
const t = require('tap')
-const log = require('../../../lib/utils/log-shim')
-
-const _level = log.level
-t.beforeEach(() => log.level = 'warn')
-t.teardown(() => log.level = _level)
t.cleanSnapshot = str => str.replace(/in [0-9]+m?s/g, 'in {TIME}')
@@ -13,6 +8,7 @@ const settings = {
const npm = {
started: Date.now(),
flatOptions: settings,
+ silent: false,
}
const reifyOutput = require('../../../lib/utils/reify-output.js')
t.test('missing info', (t) => {
@@ -236,10 +232,13 @@ t.test('showing and not showing audit report', async t => {
}
t.test('no output when silent', t => {
+ t.teardown(() => {
+ delete npm.silent
+ })
+ npm.silent = true
npm.output = out => {
t.fail('should not get output when silent', { actual: out })
}
- log.level = 'silent'
reifyOutput(npm, {
actualTree: { inventory: { size: 999 }, children: [] },
auditReport,
diff --git a/deps/npm/test/lib/utils/update-notifier.js b/deps/npm/test/lib/utils/update-notifier.js
index a7a800c602..fa4af29476 100644
--- a/deps/npm/test/lib/utils/update-notifier.js
+++ b/deps/npm/test/lib/utils/update-notifier.js
@@ -84,12 +84,11 @@ t.afterEach(() => {
})
const runUpdateNotifier = async ({ color = true, ...npmOptions } = {}) => {
- const _npm = { ...defaultNpm, ...npmOptions }
+ const _npm = { ...defaultNpm, ...npmOptions, logColor: color }
await t.mock('../../../lib/utils/update-notifier.js', {
'@npmcli/ci-detect': () => ciMock,
pacote,
fs,
- npmlog: { useColor: () => color },
})(_npm)
return _npm.updateNotification
}