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
path: root/test
diff options
context:
space:
mode:
authornlf <quitlahok@gmail.com>2022-05-25 19:56:00 +0300
committerGitHub <noreply@github.com>2022-05-25 19:56:00 +0300
commit0f89e0750f2ac9b5b4794b5718d047b5286283c8 (patch)
tree3ca4a25f16c841498e350dfe437e5be7ee83f512 /test
parent357b0af2af2b07a58d2d837043d1d77c9495d8b5 (diff)
fix: add global getter to npm class (#4935)
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/mock-npm.js4
-rw-r--r--test/lib/commands/outdated.js12
2 files changed, 13 insertions, 3 deletions
diff --git a/test/fixtures/mock-npm.js b/test/fixtures/mock-npm.js
index c9701ebc2..a79812fb7 100644
--- a/test/fixtures/mock-npm.js
+++ b/test/fixtures/mock-npm.js
@@ -224,6 +224,10 @@ class MockNpm {
}
}
+ get global () {
+ return this.config.get('global') || this.config.get('location') === 'global'
+ }
+
output (...msg) {
if (this.base.output) {
return this.base.output(msg)
diff --git a/test/lib/commands/outdated.js b/test/lib/commands/outdated.js
index 14647ce6c..4803c7e17 100644
--- a/test/lib/commands/outdated.js
+++ b/test/lib/commands/outdated.js
@@ -343,7 +343,9 @@ t.test('should return if no outdated deps', async t => {
})
await outdated(testDir, {
- global: false,
+ config: {
+ global: false,
+ },
}).exec([])
t.equal(logs.length, 0, 'no logs')
})
@@ -369,7 +371,9 @@ t.test('throws if error with a dep', async t => {
await t.rejects(
outdated(testDir, {
- global: false,
+ config: {
+ global: false,
+ },
}).exec([]),
'There is an error with this package.'
)
@@ -388,7 +392,9 @@ t.test('should skip missing non-prod deps', async t => {
})
await outdated(testDir, {
- global: false,
+ config: {
+ global: false,
+ },
}).exec([])
t.equal(logs.length, 0, 'no logs')
})