summaryrefslogtreecommitdiff
path: root/deps/npm/test/lib/shrinkwrap.js
diff options
context:
space:
mode:
authorRuy Adorno <ruyadorno@hotmail.com>2021-03-23 14:58:11 -0400
committerRuy Adorno <ruyadorno@hotmail.com>2021-03-23 22:10:30 -0400
commit73b3e06c910549a7fd3c8f49324ab14e0adf2c8d (patch)
treee7f0ab70d8bb09a6212f8a22da25dc07410e6967 /deps/npm/test/lib/shrinkwrap.js
parentf2090877f1f727020099ef9e30cc70e10b10f900 (diff)
downloadnode-new-73b3e06c910549a7fd3c8f49324ab14e0adf2c8d.tar.gz
deps: upgrade npm to 7.7.0
PR-URL: https://github.com/nodejs/node/pull/37879 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'deps/npm/test/lib/shrinkwrap.js')
-rw-r--r--deps/npm/test/lib/shrinkwrap.js32
1 files changed, 19 insertions, 13 deletions
diff --git a/deps/npm/test/lib/shrinkwrap.js b/deps/npm/test/lib/shrinkwrap.js
index dc4bc3b220..faf452ea70 100644
--- a/deps/npm/test/lib/shrinkwrap.js
+++ b/deps/npm/test/lib/shrinkwrap.js
@@ -1,16 +1,21 @@
const t = require('tap')
const fs = require('fs')
const requireInject = require('require-inject')
+const mockNpm = require('../fixtures/mock-npm')
-const npm = {
+const config = {
+ global: false,
+}
+const flatOptions = {
+ depth: 0,
+}
+const npm = mockNpm({
+ config,
+ flatOptions,
lockfileVersion: 2,
globalDir: '',
- flatOptions: {
- depth: 0,
- global: false,
- },
prefix: '',
-}
+})
const tree = {
meta: {
hiddenLockfile: null,
@@ -32,11 +37,12 @@ const mocks = {
}
},
'../../lib/utils/usage.js': () => 'usage instructions',
+ '../../lib/utils/config/definitions.js': {},
}
t.afterEach(cb => {
npm.prefix = ''
- npm.flatOptions.global = false
+ config.global = false
npm.globalDir = ''
cb()
})
@@ -50,7 +56,7 @@ t.test('no args', t => {
constructor (args) {
t.deepEqual(
args,
- { ...npm.flatOptions, path: npm.prefix },
+ { ...flatOptions, path: npm.prefix },
'should call arborist constructor with expected args'
)
}
@@ -101,7 +107,7 @@ t.test('no virtual tree', t => {
constructor (args) {
t.deepEqual(
args,
- { ...npm.flatOptions, path: npm.prefix },
+ { ...flatOptions, path: npm.prefix },
'should call arborist constructor with expected args'
)
}
@@ -156,7 +162,7 @@ t.test('existing package-json file', t => {
constructor (args) {
t.deepEqual(
args,
- { ...npm.flatOptions, path: npm.prefix },
+ { ...flatOptions, path: npm.prefix },
'should call arborist constructor with expected args'
)
}
@@ -218,7 +224,7 @@ t.test('update shrinkwrap file version', t => {
constructor (args) {
t.deepEqual(
args,
- { ...npm.flatOptions, path: npm.prefix },
+ { ...flatOptions, path: npm.prefix },
'should call arborist constructor with expected args'
)
}
@@ -272,7 +278,7 @@ t.test('update to date shrinkwrap file', t => {
constructor (args) {
t.deepEqual(
args,
- { ...npm.flatOptions, path: npm.prefix },
+ { ...flatOptions, path: npm.prefix },
'should call arborist constructor with expected args'
)
}
@@ -320,7 +326,7 @@ t.test('update to date shrinkwrap file', t => {
t.test('shrinkwrap --global', t => {
const Shrinkwrap = requireInject('../../lib/shrinkwrap.js', mocks)
- npm.flatOptions.global = true
+ config.global = true
const shrinkwrap = new Shrinkwrap(npm)
shrinkwrap.exec([], err => {