diff --git a/deps/npm/docs/content/configuring-npm/package-json.md b/deps/npm/docs/content/configuring-npm/package-json.md index 530df0971c8ebe..a6298f0c436c38 100644 --- a/deps/npm/docs/content/configuring-npm/package-json.md +++ b/deps/npm/docs/content/configuring-npm/package-json.md @@ -323,7 +323,7 @@ This should be a module relative to the root of your package folder. For most modules, it makes the most sense to have a main script and often not much else. -If `main` is not set it defaults to `index.js` in the packages root folder. +If `main` is not set it defaults to `index.js` in the package's root folder. ### browser diff --git a/deps/npm/docs/output/commands/npm-ls.html b/deps/npm/docs/output/commands/npm-ls.html index 3269bcc579a886..71266906e656a0 100644 --- a/deps/npm/docs/output/commands/npm-ls.html +++ b/deps/npm/docs/output/commands/npm-ls.html @@ -166,7 +166,7 @@
npm ls promzard
in npm's source tree will show:
-npm@8.5.3 /path/to/npm
+npm@8.5.4 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
diff --git a/deps/npm/docs/output/commands/npm.html b/deps/npm/docs/output/commands/npm.html
index 89bdc4f6d0b238..c7f39d123162ee 100644
--- a/deps/npm/docs/output/commands/npm.html
+++ b/deps/npm/docs/output/commands/npm.html
@@ -149,7 +149,7 @@ Table of contents
Version
-8.5.3
+8.5.4
Description
npm is the package manager for the Node JavaScript platform. It puts
modules in place so that node can find them, and manages dependency
diff --git a/deps/npm/docs/output/configuring-npm/package-json.html b/deps/npm/docs/output/configuring-npm/package-json.html
index 9aed0d3070d90e..866e104991b3c6 100644
--- a/deps/npm/docs/output/configuring-npm/package-json.html
+++ b/deps/npm/docs/output/configuring-npm/package-json.html
@@ -391,7 +391,7 @@
main
This should be a module relative to the root of your package folder.
For most modules, it makes the most sense to have a main script and often
not much else.
-If main
is not set it defaults to index.js
in the packages root folder.
+If main
is not set it defaults to index.js
in the package's root folder.
browser
If your module is meant to be used client-side the browser field should be
used instead of the main field. This is helpful to hint users that it might
diff --git a/deps/npm/lib/commands/doctor.js b/deps/npm/lib/commands/doctor.js
index 9af4c4cd6ffbfc..630150c0886fed 100644
--- a/deps/npm/lib/commands/doctor.js
+++ b/deps/npm/lib/commands/doctor.js
@@ -10,7 +10,6 @@ const semver = require('semver')
const { promisify } = require('util')
const log = require('../utils/log-shim.js')
const ansiTrim = require('../utils/ansi-trim.js')
-const isWindows = require('../utils/is-windows.js')
const ping = require('../utils/ping.js')
const {
registry: { default: defaultRegistry },
@@ -55,32 +54,36 @@ class Doctor extends BaseCommand {
['node -v', 'getLatestNodejsVersion', []],
['npm config get registry', 'checkNpmRegistry', []],
['which git', 'getGitPath', []],
- ...(isWindows
+ ...(process.platform === 'win32'
? []
: [
- ['Perms check on cached files', 'checkFilesPermission', [this.npm.cache, true, R_OK]],
[
+ 'Perms check on cached files',
+ 'checkFilesPermission',
+ [this.npm.cache, true, R_OK],
+ ], [
'Perms check on local node_modules',
'checkFilesPermission',
- [this.npm.localDir, true],
- ],
- [
+ [this.npm.localDir, true, R_OK | W_OK, true],
+ ], [
'Perms check on global node_modules',
'checkFilesPermission',
- [this.npm.globalDir, false],
- ],
- [
+ [this.npm.globalDir, false, R_OK],
+ ], [
'Perms check on local bin folder',
'checkFilesPermission',
- [this.npm.localBin, false, R_OK | W_OK | X_OK],
- ],
- [
+ [this.npm.localBin, false, R_OK | W_OK | X_OK, true],
+ ], [
'Perms check on global bin folder',
'checkFilesPermission',
[this.npm.globalBin, false, X_OK],
],
]),
- ['Verify cache contents', 'verifyCachedFiles', [this.npm.flatOptions.cache]],
+ [
+ 'Verify cache contents',
+ 'verifyCachedFiles',
+ [this.npm.flatOptions.cache],
+ ],
// TODO:
// - ensure arborist.loadActual() runs without errors and no invalid edges
// - ensure package-lock.json matches loadActual()
@@ -129,6 +132,7 @@ class Doctor extends BaseCommand {
if (!this.npm.silent) {
this.npm.output(table(outTable, tableOpts))
if (!allOk) {
+ // TODO is this really needed?
console.error('')
}
}
@@ -141,7 +145,7 @@ class Doctor extends BaseCommand {
const tracker = log.newItem('checkPing', 1)
tracker.info('checkPing', 'Pinging registry')
try {
- await ping(this.npm.flatOptions)
+ await ping({ ...this.npm.flatOptions, retry: false })
return ''
} catch (er) {
if (/^E\d{3}$/.test(er.code || '')) {
@@ -201,11 +205,7 @@ class Doctor extends BaseCommand {
}
}
- async checkFilesPermission (root, shouldOwn, mask = null) {
- if (mask === null) {
- mask = shouldOwn ? R_OK | W_OK : R_OK
- }
-
+ async checkFilesPermission (root, shouldOwn, mask, missingOk) {
let ok = true
const tracker = log.newItem(root, 1)
@@ -217,8 +217,11 @@ class Doctor extends BaseCommand {
for (const f of files) {
tracker.silly('checkFilesPermission', f.substr(root.length + 1))
const st = await lstat(f).catch(er => {
- ok = false
- tracker.warn('checkFilesPermission', 'error getting info for ' + f)
+ // if it can't be missing, or if it can and the error wasn't that it was missing
+ if (!missingOk || er.code !== 'ENOENT') {
+ ok = false
+ tracker.warn('checkFilesPermission', 'error getting info for ' + f)
+ }
})
tracker.completeWork(1)
diff --git a/deps/npm/lib/commands/owner.js b/deps/npm/lib/commands/owner.js
index 93e0a45ad1e274..ceff5513afe641 100644
--- a/deps/npm/lib/commands/owner.js
+++ b/deps/npm/lib/commands/owner.js
@@ -59,60 +59,39 @@ class Owner extends BaseCommand {
}
async exec ([action, ...args]) {
- const opts = {
- ...this.npm.flatOptions,
- }
switch (action) {
case 'ls':
case 'list':
- return this.ls(args[0], opts)
+ return this.ls(args[0])
case 'add':
- return this.add(args[0], args[1], opts)
+ return this.changeOwners(args[0], args[1], 'add')
case 'rm':
case 'remove':
- return this.rm(args[0], args[1], opts)
+ return this.changeOwners(args[0], args[1], 'rm')
default:
throw this.usageError()
}
}
- async ls (pkg, opts) {
- if (!pkg) {
- if (this.npm.config.get('global')) {
- throw this.usageError()
- }
-
- const pkgName = await readLocalPkgName(this.npm.prefix)
- if (!pkgName) {
- throw this.usageError()
- }
-
- pkg = pkgName
- }
-
+ async ls (pkg) {
+ pkg = await this.getPkg(pkg)
const spec = npa(pkg)
try {
- const packumentOpts = { ...opts, fullMetadata: true }
+ const packumentOpts = { ...this.npm.flatOptions, fullMetadata: true }
const { maintainers } = await pacote.packument(spec, packumentOpts)
if (!maintainers || !maintainers.length) {
this.npm.output('no admin found')
} else {
- this.npm.output(maintainers.map(o => `${o.name} <${o.email}>`).join('\n'))
+ this.npm.output(maintainers.map(m => `${m.name} <${m.email}>`).join('\n'))
}
-
- return maintainers
} catch (err) {
log.error('owner ls', "Couldn't get owner data", pkg)
throw err
}
}
- async add (user, pkg, opts) {
- if (!user) {
- throw this.usageError()
- }
-
+ async getPkg (pkg) {
if (!pkg) {
if (this.npm.config.get('global')) {
throw this.usageError()
@@ -122,44 +101,25 @@ class Owner extends BaseCommand {
throw this.usageError()
}
- pkg = pkgName
+ return pkgName
}
- log.verbose('owner add', '%s to %s', user, pkg)
-
- const spec = npa(pkg)
- return this.putOwners(spec, user, opts,
- (newOwner, owners) => this.validateAddOwner(newOwner, owners))
+ return pkg
}
- async rm (user, pkg, opts) {
+ async changeOwners (user, pkg, addOrRm) {
if (!user) {
throw this.usageError()
}
- if (!pkg) {
- if (this.npm.config.get('global')) {
- throw this.usageError()
- }
- const pkgName = await readLocalPkgName(this.npm.prefix)
- if (!pkgName) {
- throw this.usageError()
- }
-
- pkg = pkgName
- }
- log.verbose('owner rm', '%s from %s', user, pkg)
+ pkg = await this.getPkg(pkg)
+ log.verbose(`owner ${addOrRm}`, '%s to %s', user, pkg)
const spec = npa(pkg)
- return this.putOwners(spec, user, opts,
- (rmOwner, owners) => this.validateRmOwner(rmOwner, owners))
- }
-
- async putOwners (spec, user, opts, validation) {
const uri = `/-/user/org.couchdb.user:${encodeURIComponent(user)}`
- let u = ''
+ let u
try {
- u = await npmFetch.json(uri, opts)
+ u = await npmFetch.json(uri, this.npm.flatOptions)
} catch (err) {
log.error('owner mutate', `Error getting user data for ${user}`)
throw err
@@ -177,36 +137,60 @@ class Owner extends BaseCommand {
// normalize user data
u = { name: u.name, email: u.email }
- const data = await pacote.packument(spec, { ...opts, fullMetadata: true })
+ const data = await pacote.packument(spec, { ...this.npm.flatOptions, fullMetadata: true })
- // save the number of maintainers before validation for comparison
- const before = data.maintainers ? data.maintainers.length : 0
+ const owners = data.maintainers || []
+ let maintainers
+ if (addOrRm === 'add') {
+ const existing = owners.find(o => o.name === u.name)
+ if (existing) {
+ log.info(
+ 'owner add',
+ `Already a package owner: ${existing.name} <${existing.email}>`
+ )
+ return
+ }
+ maintainers = [
+ ...owners,
+ u,
+ ]
+ } else {
+ maintainers = owners.filter(o => o.name !== u.name)
- const m = validation(u, data.maintainers)
- if (!m) {
- return
- } // invalid owners
+ if (maintainers.length === owners.length) {
+ log.info('owner rm', 'Not a package owner: ' + u.name)
+ return false
+ }
- const body = {
- _id: data._id,
- _rev: data._rev,
- maintainers: m,
+ if (!maintainers.length) {
+ throw Object.assign(
+ new Error(
+ 'Cannot remove all owners of a package. Add someone else first.'
+ ),
+ { code: 'EOWNERRM' }
+ )
+ }
}
+
const dataPath = `/${spec.escapedName}/-rev/${encodeURIComponent(data._rev)}`
- const res = await otplease(opts, opts => {
+ const res = await otplease(this.npm.flatOptions, opts => {
return npmFetch.json(dataPath, {
...opts,
method: 'PUT',
- body,
+ body: {
+ _id: data._id,
+ _rev: data._rev,
+ maintainers,
+ },
spec,
})
})
if (!res.error) {
- if (m.length < before) {
- this.npm.output(`- ${user} (${spec.name})`)
- } else {
+ if (addOrRm === 'add') {
this.npm.output(`+ ${user} (${spec.name})`)
+ } else {
+ this.npm.output(`- ${user} (${spec.name})`)
}
} else {
throw Object.assign(
@@ -216,47 +200,6 @@ class Owner extends BaseCommand {
}
return res
}
-
- validateAddOwner (newOwner, owners) {
- owners = owners || []
- for (const o of owners) {
- if (o.name === newOwner.name) {
- log.info(
- 'owner add',
- 'Already a package owner: ' + o.name + ' <' + o.email + '>'
- )
- return false
- }
- }
- return [
- ...owners,
- newOwner,
- ]
- }
-
- validateRmOwner (rmOwner, owners) {
- let found = false
- const m = owners.filter(function (o) {
- var match = (o.name === rmOwner.name)
- found = found || match
- return !match
- })
-
- if (!found) {
- log.info('owner rm', 'Not a package owner: ' + rmOwner.name)
- return false
- }
-
- if (!m.length) {
- throw Object.assign(
- new Error(
- 'Cannot remove all owners of a package. Add someone else first.'
- ),
- { code: 'EOWNERRM' }
- )
- }
-
- return m
- }
}
+
module.exports = Owner
diff --git a/deps/npm/lib/utils/otplease.js b/deps/npm/lib/utils/otplease.js
index 0e32493f9eb3e8..566c24ef2e293b 100644
--- a/deps/npm/lib/utils/otplease.js
+++ b/deps/npm/lib/utils/otplease.js
@@ -1,20 +1,17 @@
-const prompt = 'This operation requires a one-time password.\nEnter OTP:'
const readUserInfo = require('./read-user-info.js')
-const isOtpError = err =>
- err.code === 'EOTP' || (err.code === 'E401' && /one-time pass/.test(err.body))
-
module.exports = otplease
-function otplease (opts, fn) {
- opts = { prompt, ...opts }
- return Promise.resolve().then(() => fn(opts)).catch(err => {
- if (!isOtpError(err)) {
+async function otplease (opts, fn) {
+ try {
+ await fn(opts)
+ } catch (err) {
+ if (err.code !== 'EOTP' && (err.code !== 'E401' || !/one-time pass/.test(err.body))) {
throw err
} else if (!process.stdin.isTTY || !process.stdout.isTTY) {
throw err
} else {
- return readUserInfo.otp(opts.prompt)
- .then(otp => fn({ ...opts, otp }))
+ const otp = await readUserInfo.otp('This operation requires a one-time password.\nEnter OTP:')
+ return fn({ ...opts, otp })
}
- })
+ }
}
diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1
index 50ea904cebb739..8109df3e91718b 100644
--- a/deps/npm/man/man1/npm-ls.1
+++ b/deps/npm/man/man1/npm-ls.1
@@ -26,7 +26,7 @@ example, running \fBnpm ls promzard\fP in npm's source tree will show:
.P
.RS 2
.nf
-npm@8\.5\.3 /path/to/npm
+npm@8\.5\.4 /path/to/npm
└─┬ init\-package\-json@0\.0\.4
└── promzard@0\.1\.5
.fi
diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1
index 0b65e8ff019627..06e0c816153308 100644
--- a/deps/npm/man/man1/npm.1
+++ b/deps/npm/man/man1/npm.1
@@ -4,7 +4,7 @@
.SS Synopsis
.SS Version
.P
-8\.5\.3
+8\.5\.4
.SS Description
.P
npm is the package manager for the Node JavaScript platform\. It puts
diff --git a/deps/npm/man/man5/package-json.5 b/deps/npm/man/man5/package-json.5
index fb7dd46c6f5379..efcca0777d0868 100644
--- a/deps/npm/man/man5/package-json.5
+++ b/deps/npm/man/man5/package-json.5
@@ -370,7 +370,7 @@ This should be a module relative to the root of your package folder\.
For most modules, it makes the most sense to have a main script and often
not much else\.
.P
-If \fBmain\fP is not set it defaults to \fBindex\.js\fP in the packages root folder\.
+If \fBmain\fP is not set it defaults to \fBindex\.js\fP in the package's root folder\.
.SS browser
.P
If your module is meant to be used client\-side the browser field should be
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js
index 09b4419f5b5dcc..8b47904004a967 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js
@@ -136,15 +136,19 @@ module.exports = cls => class Builder extends cls {
process.emit('time', `build:${type}`)
await this[_buildQueues](nodes)
- if (!this[_ignoreScripts]) {
- await this[_runScripts]('preinstall')
- }
- if (this[_binLinks] && type !== 'links') {
- await this[_linkAllBins]()
- }
-
- // links should also run prepare scripts and only link bins after that
- if (type === 'links') {
+ // links should run prepare scripts and only link bins after that
+ if (type !== 'links') {
+ if (!this[_ignoreScripts]) {
+ await this[_runScripts]('preinstall')
+ }
+ if (this[_binLinks]) {
+ await this[_linkAllBins]()
+ }
+ if (!this[_ignoreScripts]) {
+ await this[_runScripts]('install')
+ await this[_runScripts]('postinstall')
+ }
+ } else {
await this[_runScripts]('prepare')
if (this[_binLinks]) {
@@ -152,11 +156,6 @@ module.exports = cls => class Builder extends cls {
}
}
- if (!this[_ignoreScripts]) {
- await this[_runScripts]('install')
- await this[_runScripts]('postinstall')
- }
-
process.emit('timeEnd', `build:${type}`)
}
diff --git a/deps/npm/node_modules/@npmcli/arborist/package.json b/deps/npm/node_modules/@npmcli/arborist/package.json
index c9dee34b72c4fb..3a4c83f553f328 100644
--- a/deps/npm/node_modules/@npmcli/arborist/package.json
+++ b/deps/npm/node_modules/@npmcli/arborist/package.json
@@ -1,6 +1,6 @@
{
"name": "@npmcli/arborist",
- "version": "5.0.0",
+ "version": "5.0.2",
"description": "Manage node_modules trees",
"dependencies": {
"@isaacs/string-locale-compare": "^1.1.0",
diff --git a/deps/npm/node_modules/@npmcli/map-workspaces/lib/index.js b/deps/npm/node_modules/@npmcli/map-workspaces/lib/index.js
index a2401b565b3353..3ac545e9c15c4e 100644
--- a/deps/npm/node_modules/@npmcli/map-workspaces/lib/index.js
+++ b/deps/npm/node_modules/@npmcli/map-workspaces/lib/index.js
@@ -117,28 +117,52 @@ async function mapWorkspaces (opts = {}) {
const name = getPackageName(pkg, packagePathname)
+ let seenPackagePathnames = seen.get(name)
+ if (!seenPackagePathnames) {
+ seenPackagePathnames = new Set()
+ seen.set(name, seenPackagePathnames)
+ }
if (item.negate) {
- results.delete(packagePathname, name)
+ seenPackagePathnames.delete(packagePathname)
} else {
- if (seen.has(name) && seen.get(name) !== packagePathname) {
- throw getError({
- Type: Error,
- message: [
- 'must not have multiple workspaces with the same name',
- `package '${name}' has conflicts in the following paths:`,
- ' ' + seen.get(name),
- ' ' + packagePathname,
- ].join('\n'),
- code: 'EDUPLICATEWORKSPACE',
- })
- }
-
- seen.set(name, packagePathname)
- results.set(packagePathname, name)
+ seenPackagePathnames.add(packagePathname)
}
}
}
- return reverseResultMap(results)
+
+ const errorMessageArray = ['must not have multiple workspaces with the same name']
+ for (const [packageName, seenPackagePathnames] of seen) {
+ if (seenPackagePathnames.size === 0) {
+ continue
+ }
+ if (seenPackagePathnames.size > 1) {
+ addDuplicateErrorMessages(errorMessageArray, packageName, seenPackagePathnames)
+ } else {
+ results.set(packageName, seenPackagePathnames.values().next().value)
+ }
+ }
+
+ if (errorMessageArray.length > 1) {
+ throw getError({
+ Type: Error,
+ message: errorMessageArray.join('\n'),
+ code: 'EDUPLICATEWORKSPACE',
+ })
+ }
+
+ return results
+}
+
+function addDuplicateErrorMessages (messageArray, packageName, packagePathnames) {
+ messageArray.push(
+ `package '${packageName}' has conflicts in the following paths:`
+ )
+
+ for (const packagePathname of packagePathnames) {
+ messageArray.push(
+ ' ' + packagePathname
+ )
+ }
}
mapWorkspaces.virtual = function (opts = {}) {
diff --git a/deps/npm/node_modules/@npmcli/map-workspaces/package.json b/deps/npm/node_modules/@npmcli/map-workspaces/package.json
index aa46ad0f42f2de..8ae823cf3e9b7b 100644
--- a/deps/npm/node_modules/@npmcli/map-workspaces/package.json
+++ b/deps/npm/node_modules/@npmcli/map-workspaces/package.json
@@ -1,6 +1,6 @@
{
"name": "@npmcli/map-workspaces",
- "version": "2.0.1",
+ "version": "2.0.2",
"main": "lib/index.js",
"files": [
"bin",
@@ -37,23 +37,18 @@
"tap": {
"check-coverage": true
},
- "standard": {
- "ignore": [
- "/tap-snapshots/"
- ]
- },
"devDependencies": {
- "@npmcli/template-oss": "^2.7.1",
- "eslint": "^8.9.0",
+ "@npmcli/template-oss": "^2.9.2",
+ "eslint": "^8.10.0",
"tap": "^15.1.6"
},
"dependencies": {
"@npmcli/name-from-folder": "^1.0.1",
"glob": "^7.2.0",
- "minimatch": "^5.0.0",
+ "minimatch": "^5.0.1",
"read-package-json-fast": "^2.0.3"
},
"templateOSS": {
- "version": "2.7.1"
+ "version": "2.9.2"
}
}
diff --git a/deps/npm/node_modules/gauge/lib/demo.js b/deps/npm/node_modules/gauge/lib/demo.js
deleted file mode 100644
index 88c03cd9a4040c..00000000000000
--- a/deps/npm/node_modules/gauge/lib/demo.js
+++ /dev/null
@@ -1,45 +0,0 @@
-var Gauge = require('./')
-var gaugeDefault = require('./themes.js')
-var onExit = require('signal-exit')
-
-var activeGauge
-
-onExit(function () {
- activeGauge.disable()
-})
-
-var themes = gaugeDefault.getThemeNames()
-
-nextBar()
-function nextBar () {
- var themeName = themes.shift()
-
- console.log('Demoing output for ' + themeName)
-
- var gt = new Gauge(process.stderr, {
- updateInterval: 50,
- theme: themeName,
- cleanupOnExit: false,
- })
- activeGauge = gt
-
- var progress = 0
-
- var cnt = 0
- var pulse = setInterval(function () {
- gt.pulse('this is a thing that happened ' + (++cnt))
- }, 110)
- var prog = setInterval(function () {
- progress += 0.04
- gt.show(themeName + ':' + Math.round(progress * 1000), progress)
- if (progress >= 1) {
- clearInterval(prog)
- clearInterval(pulse)
- gt.disable()
- if (themes.length) {
- nextBar()
- }
- }
- }, 100)
- gt.show()
-}
diff --git a/deps/npm/node_modules/gauge/package.json b/deps/npm/node_modules/gauge/package.json
index 4a6ebf285b3eda..431d906a9e481c 100644
--- a/deps/npm/node_modules/gauge/package.json
+++ b/deps/npm/node_modules/gauge/package.json
@@ -1,6 +1,6 @@
{
"name": "gauge",
- "version": "4.0.2",
+ "version": "4.0.3",
"description": "A terminal based horizontal gauge",
"main": "lib",
"scripts": {
@@ -31,7 +31,6 @@
},
"homepage": "https://github.com/npm/gauge",
"dependencies": {
- "ansi-regex": "^5.0.1",
"aproba": "^1.0.3 || ^2.0.0",
"color-support": "^1.1.3",
"console-control-strings": "^1.1.0",
@@ -42,7 +41,7 @@
"wide-align": "^1.1.5"
},
"devDependencies": {
- "@npmcli/template-oss": "^2.7.1",
+ "@npmcli/template-oss": "^2.9.2",
"readable-stream": "^3.6.0",
"tap": "^15.1.6"
},
@@ -60,6 +59,6 @@
"lines": 90
},
"templateOSS": {
- "version": "2.7.1"
+ "version": "2.9.2"
}
}
diff --git a/deps/npm/node_modules/libnpmaccess/package.json b/deps/npm/node_modules/libnpmaccess/package.json
index 7f0b335b388dc0..ac5e8e7b212478 100644
--- a/deps/npm/node_modules/libnpmaccess/package.json
+++ b/deps/npm/node_modules/libnpmaccess/package.json
@@ -1,6 +1,6 @@
{
"name": "libnpmaccess",
- "version": "6.0.0",
+ "version": "6.0.1",
"description": "programmatic library for `npm access` commands",
"author": "GitHub Inc.",
"license": "ISC",
diff --git a/deps/npm/node_modules/libnpmdiff/package.json b/deps/npm/node_modules/libnpmdiff/package.json
index 883748ee63f858..d1f9a92d289bea 100644
--- a/deps/npm/node_modules/libnpmdiff/package.json
+++ b/deps/npm/node_modules/libnpmdiff/package.json
@@ -1,6 +1,6 @@
{
"name": "libnpmdiff",
- "version": "4.0.0",
+ "version": "4.0.1",
"description": "The registry diff",
"repository": {
"type": "git",
diff --git a/deps/npm/node_modules/libnpmexec/package.json b/deps/npm/node_modules/libnpmexec/package.json
index 26cede0da7b578..4f607099b10e31 100644
--- a/deps/npm/node_modules/libnpmexec/package.json
+++ b/deps/npm/node_modules/libnpmexec/package.json
@@ -1,6 +1,6 @@
{
"name": "libnpmexec",
- "version": "4.0.0",
+ "version": "4.0.1",
"files": [
"bin",
"lib"
diff --git a/deps/npm/node_modules/libnpmfund/package.json b/deps/npm/node_modules/libnpmfund/package.json
index 8af2c2b11570f1..2abf897eefeb86 100644
--- a/deps/npm/node_modules/libnpmfund/package.json
+++ b/deps/npm/node_modules/libnpmfund/package.json
@@ -1,6 +1,6 @@
{
"name": "libnpmfund",
- "version": "3.0.0",
+ "version": "3.0.1",
"main": "lib/index.js",
"files": [
"bin",
diff --git a/deps/npm/node_modules/libnpmhook/package.json b/deps/npm/node_modules/libnpmhook/package.json
index ad10da8865052a..ebe0d78c5d8f0a 100644
--- a/deps/npm/node_modules/libnpmhook/package.json
+++ b/deps/npm/node_modules/libnpmhook/package.json
@@ -1,6 +1,6 @@
{
"name": "libnpmhook",
- "version": "8.0.0",
+ "version": "8.0.1",
"description": "programmatic API for managing npm registry hooks",
"main": "lib/index.js",
"files": [
diff --git a/deps/npm/node_modules/libnpmorg/package.json b/deps/npm/node_modules/libnpmorg/package.json
index 707b5318696934..c0035202256006 100644
--- a/deps/npm/node_modules/libnpmorg/package.json
+++ b/deps/npm/node_modules/libnpmorg/package.json
@@ -1,6 +1,6 @@
{
"name": "libnpmorg",
- "version": "4.0.0",
+ "version": "4.0.1",
"description": "Programmatic api for `npm org` commands",
"author": "GitHub Inc.",
"main": "lib/index.js",
diff --git a/deps/npm/node_modules/libnpmpack/package.json b/deps/npm/node_modules/libnpmpack/package.json
index 586bd3153b14d7..9f7e56a1ad4dd2 100644
--- a/deps/npm/node_modules/libnpmpack/package.json
+++ b/deps/npm/node_modules/libnpmpack/package.json
@@ -1,6 +1,6 @@
{
"name": "libnpmpack",
- "version": "4.0.0",
+ "version": "4.0.1",
"description": "Programmatic API for the bits behind npm pack",
"author": "GitHub Inc.",
"main": "lib/index.js",
diff --git a/deps/npm/node_modules/libnpmpublish/package.json b/deps/npm/node_modules/libnpmpublish/package.json
index c155df4cf2cc2d..441a10b17c0a4e 100644
--- a/deps/npm/node_modules/libnpmpublish/package.json
+++ b/deps/npm/node_modules/libnpmpublish/package.json
@@ -1,6 +1,6 @@
{
"name": "libnpmpublish",
- "version": "6.0.0",
+ "version": "6.0.1",
"description": "Programmatic API for the bits behind npm publish and unpublish",
"author": "GitHub Inc.",
"main": "lib/index.js",
diff --git a/deps/npm/node_modules/libnpmsearch/package.json b/deps/npm/node_modules/libnpmsearch/package.json
index 0c14b707d20705..89c3454712aa21 100644
--- a/deps/npm/node_modules/libnpmsearch/package.json
+++ b/deps/npm/node_modules/libnpmsearch/package.json
@@ -1,6 +1,6 @@
{
"name": "libnpmsearch",
- "version": "5.0.0",
+ "version": "5.0.1",
"description": "Programmatic API for searching in npm and compatible registries.",
"author": "GitHub Inc.",
"main": "lib/index.js",
diff --git a/deps/npm/node_modules/libnpmteam/package.json b/deps/npm/node_modules/libnpmteam/package.json
index 2861f74cbfe53a..1eb5868f40bb49 100644
--- a/deps/npm/node_modules/libnpmteam/package.json
+++ b/deps/npm/node_modules/libnpmteam/package.json
@@ -1,7 +1,7 @@
{
"name": "libnpmteam",
"description": "npm Team management APIs",
- "version": "4.0.0",
+ "version": "4.0.1",
"author": "GitHub Inc.",
"license": "ISC",
"main": "lib/index.js",
diff --git a/deps/npm/node_modules/libnpmversion/package.json b/deps/npm/node_modules/libnpmversion/package.json
index 16302f6737aa6a..ddb56c1cf32cf3 100644
--- a/deps/npm/node_modules/libnpmversion/package.json
+++ b/deps/npm/node_modules/libnpmversion/package.json
@@ -1,6 +1,6 @@
{
"name": "libnpmversion",
- "version": "3.0.0",
+ "version": "3.0.1",
"main": "lib/index.js",
"files": [
"bin",
diff --git a/deps/npm/node_modules/make-fetch-happen/lib/agent.js b/deps/npm/node_modules/make-fetch-happen/lib/agent.js
index cc1d388691961f..d28a31bfbda0cb 100644
--- a/deps/npm/node_modules/make-fetch-happen/lib/agent.js
+++ b/deps/npm/node_modules/make-fetch-happen/lib/agent.js
@@ -198,6 +198,7 @@ function getProxy (proxyUrl, opts, isHttps) {
throw Object.assign(
new Error(`unsupported proxy protocol: '${proxyUrl.protocol}'`),
{
+ code: 'EUNSUPPORTEDPROXY',
url: proxyUrl.href,
}
)
diff --git a/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/bundle/main.js b/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/bundle/main.js
index 7eef327e92527f..b9c8be2ffa2e4b 100644
--- a/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/bundle/main.js
+++ b/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/bundle/main.js
@@ -1 +1 @@
-(()=>{var t={10:t=>{const i="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,s=new Set,e=(t,i)=>{const s=`LRU_CACHE_OPTION_${t}`;l(s)&&o(s,`${t} option`,`options.${i}`,d)},h=(t,i)=>{const s=`LRU_CACHE_METHOD_${t}`;if(l(s)){const{prototype:e}=d,{get:h}=Object.getOwnPropertyDescriptor(e,t);o(s,`${t} method`,`cache.${i}()`,h)}},l=t=>!(process.noDeprecation||s.has(t)),o=(t,i,e,h)=>{s.add(t),process.emitWarning(`The ${i} is deprecated. Please use ${e} instead.`,"DeprecationWarning",t,h)},n=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),a=t=>n(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?r:null:null;class r extends Array{constructor(t){super(t),this.fill(0)}}class p{constructor(t){const i=a(t);this.heap=new i(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class d{constructor(t={}){const{max:i,ttl:s,ttlResolution:h=1,ttlAutopurge:l,updateAgeOnGet:o,allowStale:r,dispose:c,disposeAfter:f,noDisposeOnSet:u,noUpdateTTL:z,maxSize:v,sizeCalculation:y}=t,{length:g,maxAge:m,stale:S}=t instanceof d?{}:t;if(!n(i))throw new TypeError("max option must be an integer");const x=a(i);if(!x)throw new Error("invalid max value: "+i);if(this.max=i,this.maxSize=v||0,this.sizeCalculation=y||g,this.sizeCalculation){if(!this.maxSize)throw new TypeError("cannot set sizeCalculation without setting maxSize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculating set to non-function")}if(this.keyMap=new Map,this.keyList=new Array(i).fill(null),this.valList=new Array(i).fill(null),this.next=new x(i),this.prev=new x(i),this.head=0,this.tail=0,this.free=new p(i),this.initialFill=1,this.size=0,"function"==typeof c&&(this.dispose=c),"function"==typeof f?(this.disposeAfter=f,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!u,this.noUpdateTTL=!!z,this.maxSize){if(!n(this.maxSize))throw new TypeError("maxSize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!r||!!S,this.updateAgeOnGet=!!o,this.ttlResolution=n(h)||0===h?h:1,this.ttlAutopurge=!!l,this.ttl=s||m||0,this.ttl){if(!n(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.initializeTTLTracking()}S&&e("stale","allowStale"),m&&e("maxAge","ttl"),g&&e("length","sizeCalculation")}initializeTTLTracking(){this.ttls=new r(this.max),this.starts=new r(this.max),this.setItemTTL=(t,s)=>{if(this.starts[t]=0!==s?i.now():0,this.ttls[t]=s,0!==s&&this.ttlAutopurge){const i=setTimeout((()=>{this.isStale(t)&&this.delete(this.keyList[t])}),s+1);i.unref&&i.unref()}},this.updateItemAge=t=>{this.starts[t]=0!==this.ttls[t]?i.now():0};let t=0;const s=()=>{const s=i.now();if(this.ttlResolution>0){t=s;const i=setTimeout((()=>t=0),this.ttlResolution);i.unref&&i.unref()}return s};this.isStale=i=>0!==this.ttls[i]&&0!==this.starts[i]&&(t||s())-this.starts[i]>this.ttls[i]}updateItemAge(t){}setItemTTL(t,i){}isStale(t){return!1}initializeSizeTracking(){this.calculatedSize=0,this.sizes=new r(this.max),this.removeItemSize=t=>this.calculatedSize-=this.sizes[t],this.addItemSize=(t,i,s,e,h)=>{const l=e||(h?h(i,s):0);this.sizes[t]=n(l)?l:0;const o=this.maxSize-this.sizes[t];for(;this.calculatedSize>o;)this.evict();this.calculatedSize+=this.sizes[t]},this.delete=t=>{if(0!==this.size){const i=this.keyMap.get(t);void 0!==i&&(this.calculatedSize-=this.sizes[i])}return d.prototype.delete.call(this,t)}}removeItemSize(t){}addItemSize(t,i,s,e,h){}*indexes(){if(this.size)for(let t=this.tail;this.isStale(t)||(yield t),t!==this.head;t=this.prev[t]);}*rindexes(){if(this.size)for(let t=this.head;this.isStale(t)||(yield t),t!==this.tail;t=this.next[t]);}*entries(){for(const t of this.indexes())yield[this.keyList[t],this.valList[t]]}*keys(){for(const t of this.indexes())yield this.keyList[t]}*values(){for(const t of this.indexes())yield this.valList[t]}[Symbol.iterator](){return this.entries()}find(t,i={}){for(const s of this.indexes())if(t(this.valList[s],this.keyList[s],this))return this.get(this.keyList[s],i)}forEach(t,i=this){for(const s of this.indexes())t.call(i,this.valList[s],this.keyList[s],this)}rforEach(t,i=this){for(const s of this.rindexes())t.call(i,this.valList[s],this.keyList[s],this)}get prune(){return h("prune","purgeStale"),this.purgeStale}purgeStale(){let t=!1;if(this.size)for(let i=this.head;;i=this.next[i]){const s=i===this.tail;if(this.isStale(i)&&(this.delete(this.keyList[i]),t=!0),s)break}return t}dump(){const t=[];for(const i of this.indexes()){const s=this.keyList[i],e={value:this.valList[i]};this.ttls&&(e.ttl=this.ttls[i]),this.sizes&&(e.size=this.sizes[i]),t.unshift([s,e])}return t}load(t){this.clear();for(const[i,s]of t)this.set(i,s.value,s)}dispose(t,i,s){}set(t,i,{ttl:s=this.ttl,noDisposeOnSet:e=this.noDisposeOnSet,size:h=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:o=this.noUpdateTTL}={}){let n=0===this.size?void 0:this.keyMap.get(t);if(void 0===n)n=this.newIndex(),this.keyList[n]=t,this.valList[n]=i,this.keyMap.set(t,n),this.next[this.tail]=n,this.prev[n]=this.tail,this.tail=n,this.size++,this.addItemSize(n,i,t,h,l),o=!1;else{const s=this.valList[n];i!==s&&(e||(this.dispose(s,t,"set"),this.disposeAfter&&this.disposed.push([s,t,"set"])),this.removeItemSize(n),this.valList[n]=i,this.addItemSize(n,i,t,h,l)),this.moveToTail(n)}if(0===s||0!==this.ttl||this.ttls||this.initializeTTLTracking(),o||this.setItemTTL(n,s),this.disposeAfter)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return this}newIndex(){return 0===this.size?this.tail:this.size===this.max?this.evict():0!==this.free.length?this.free.pop():this.initialFill++}pop(){if(this.size){const t=this.valList[this.head];return this.evict(),t}}evict(){const t=this.head,i=this.keyList[t],s=this.valList[t];return this.dispose(s,i,"evict"),this.disposeAfter&&this.disposed.push([s,i,"evict"]),this.removeItemSize(t),this.head=this.next[t],this.keyMap.delete(i),this.size--,t}has(t){return this.keyMap.has(t)&&!this.isStale(this.keyMap.get(t))}peek(t,{allowStale:i=this.allowStale}={}){const s=this.keyMap.get(t);if(void 0!==s&&(i||!this.isStale(s)))return this.valList[s]}get(t,{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet}={}){const e=this.keyMap.get(t);if(void 0!==e){if(this.isStale(e)){const s=i?this.valList[e]:void 0;return this.delete(t),s}return this.moveToTail(e),s&&this.updateItemAge(e),this.valList[e]}}connect(t,i){this.prev[i]=t,this.next[t]=i}moveToTail(t){t!==this.tail&&(t===this.head?this.head=this.next[t]:this.connect(this.prev[t],this.next[t]),this.connect(this.tail,t),this.tail=t)}get del(){return h("del","delete"),this.delete}delete(t){let i=!1;if(0!==this.size){const s=this.keyMap.get(t);void 0!==s&&(i=!0,1===this.size?this.clear():(this.removeItemSize(s),this.dispose(this.valList[s],t,"delete"),this.disposeAfter&&this.disposed.push([this.valList[s],t,"delete"]),this.keyMap.delete(t),this.keyList[s]=null,this.valList[s]=null,s===this.tail?this.tail=this.prev[s]:s===this.head?this.head=this.next[s]:(this.next[this.prev[s]]=this.next[s],this.prev[this.next[s]]=this.prev[s]),this.size--,this.free.push(s)))}if(this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return i}clear(){if(this.dispose!==d.prototype.dispose)for(const t of this.rindexes())this.dispose(this.valList[t],this.keyList[t],"delete");if(this.disposeAfter)for(const t of this.rindexes())this.disposed.push([this.valList[t],this.keyList[t],"delete"]);if(this.keyMap.clear(),this.valList.fill(null),this.keyList.fill(null),this.ttls&&(this.ttls.fill(0),this.starts.fill(0)),this.sizes&&this.sizes.fill(0),this.head=0,this.tail=0,this.initialFill=1,this.free.length=0,this.calculatedSize=0,this.size=0,this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift())}get reset(){return h("reset","clear"),this.clear}get length(){return((t,i)=>{const s="LRU_CACHE_PROPERTY_length";if(l(s)){const{prototype:i}=d,{get:e}=Object.getOwnPropertyDescriptor(i,t);o(s,"length property","cache.size",e)}})("length"),this.size}}t.exports=d}},i={},s=function s(e){var h=i[e];if(void 0!==h)return h.exports;var l=i[e]={exports:{}};return t[e](l,l.exports,s),l.exports}(10);module.exports=s})();
\ No newline at end of file
+(()=>{var t={10:t=>{const i="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,s=new Set,e=(t,i)=>{const s=`LRU_CACHE_OPTION_${t}`;l(s)&&o(s,`${t} option`,`options.${i}`,d)},h=(t,i)=>{const s=`LRU_CACHE_METHOD_${t}`;if(l(s)){const{prototype:e}=d,{get:h}=Object.getOwnPropertyDescriptor(e,t);o(s,`${t} method`,`cache.${i}()`,h)}},l=t=>"object"==typeof process&&process&&!(process.noDeprecation||s.has(t)),o=(t,i,e,h)=>{s.add(t),process.emitWarning(`The ${i} is deprecated. Please use ${e} instead.`,"DeprecationWarning",t,h)},a=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),n=t=>a(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?r:null:null;class r extends Array{constructor(t){super(t),this.fill(0)}}class p{constructor(t){const i=n(t);this.heap=new i(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class d{constructor(t={}){const{max:i,ttl:s,ttlResolution:h=1,ttlAutopurge:l,updateAgeOnGet:o,allowStale:r,dispose:c,disposeAfter:f,noDisposeOnSet:u,noUpdateTTL:z,maxSize:v,sizeCalculation:y}=t,{length:S,maxAge:g,stale:m}=t instanceof d?{}:t;if(!a(i))throw new TypeError("max option must be an integer");const x=n(i);if(!x)throw new Error("invalid max value: "+i);if(this.max=i,this.maxSize=v||0,this.sizeCalculation=y||S,this.sizeCalculation){if(!this.maxSize)throw new TypeError("cannot set sizeCalculation without setting maxSize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculating set to non-function")}if(this.keyMap=new Map,this.keyList=new Array(i).fill(null),this.valList=new Array(i).fill(null),this.next=new x(i),this.prev=new x(i),this.head=0,this.tail=0,this.free=new p(i),this.initialFill=1,this.size=0,"function"==typeof c&&(this.dispose=c),"function"==typeof f?(this.disposeAfter=f,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!u,this.noUpdateTTL=!!z,this.maxSize){if(!a(this.maxSize))throw new TypeError("maxSize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!r||!!m,this.updateAgeOnGet=!!o,this.ttlResolution=a(h)||0===h?h:1,this.ttlAutopurge=!!l,this.ttl=s||g||0,this.ttl){if(!a(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.initializeTTLTracking()}m&&e("stale","allowStale"),g&&e("maxAge","ttl"),S&&e("length","sizeCalculation")}initializeTTLTracking(){this.ttls=new r(this.max),this.starts=new r(this.max),this.setItemTTL=(t,s)=>{if(this.starts[t]=0!==s?i.now():0,this.ttls[t]=s,0!==s&&this.ttlAutopurge){const i=setTimeout((()=>{this.isStale(t)&&this.delete(this.keyList[t])}),s+1);i.unref&&i.unref()}},this.updateItemAge=t=>{this.starts[t]=0!==this.ttls[t]?i.now():0};let t=0;const s=()=>{const s=i.now();if(this.ttlResolution>0){t=s;const i=setTimeout((()=>t=0),this.ttlResolution);i.unref&&i.unref()}return s};this.isStale=i=>0!==this.ttls[i]&&0!==this.starts[i]&&(t||s())-this.starts[i]>this.ttls[i]}updateItemAge(t){}setItemTTL(t,i){}isStale(t){return!1}initializeSizeTracking(){this.calculatedSize=0,this.sizes=new r(this.max),this.removeItemSize=t=>this.calculatedSize-=this.sizes[t],this.addItemSize=(t,i,s,e,h)=>{const l=e||(h?h(i,s):0);this.sizes[t]=a(l)?l:0;const o=this.maxSize-this.sizes[t];for(;this.calculatedSize>o;)this.evict();this.calculatedSize+=this.sizes[t]},this.delete=t=>{if(0!==this.size){const i=this.keyMap.get(t);void 0!==i&&(this.calculatedSize-=this.sizes[i])}return d.prototype.delete.call(this,t)}}removeItemSize(t){}addItemSize(t,i,s,e,h){}*indexes({allowStale:t=this.allowStale}={}){if(this.size)for(let i=this.tail;!t&&this.isStale(i)||(yield i),i!==this.head;i=this.prev[i]);}*rindexes({allowStale:t=this.allowStale}={}){if(this.size)for(let i=this.head;!t&&this.isStale(i)||(yield i),i!==this.tail;i=this.next[i]);}*entries(){for(const t of this.indexes())yield[this.keyList[t],this.valList[t]]}*keys(){for(const t of this.indexes())yield this.keyList[t]}*values(){for(const t of this.indexes())yield this.valList[t]}[Symbol.iterator](){return this.entries()}find(t,i={}){for(const s of this.indexes())if(t(this.valList[s],this.keyList[s],this))return this.get(this.keyList[s],i)}forEach(t,i=this){for(const s of this.indexes())t.call(i,this.valList[s],this.keyList[s],this)}rforEach(t,i=this){for(const s of this.rindexes())t.call(i,this.valList[s],this.keyList[s],this)}get prune(){return h("prune","purgeStale"),this.purgeStale}purgeStale(){let t=!1;for(const i of this.rindexes({allowStale:!0}))this.isStale(i)&&(this.delete(this.keyList[i]),t=!0);return t}dump(){const t=[];for(const i of this.indexes()){const s=this.keyList[i],e={value:this.valList[i]};this.ttls&&(e.ttl=this.ttls[i]),this.sizes&&(e.size=this.sizes[i]),t.unshift([s,e])}return t}load(t){this.clear();for(const[i,s]of t)this.set(i,s.value,s)}dispose(t,i,s){}set(t,i,{ttl:s=this.ttl,noDisposeOnSet:e=this.noDisposeOnSet,size:h=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:o=this.noUpdateTTL}={}){let a=0===this.size?void 0:this.keyMap.get(t);if(void 0===a)a=this.newIndex(),this.keyList[a]=t,this.valList[a]=i,this.keyMap.set(t,a),this.next[this.tail]=a,this.prev[a]=this.tail,this.tail=a,this.size++,this.addItemSize(a,i,t,h,l),o=!1;else{const s=this.valList[a];i!==s&&(e||(this.dispose(s,t,"set"),this.disposeAfter&&this.disposed.push([s,t,"set"])),this.removeItemSize(a),this.valList[a]=i,this.addItemSize(a,i,t,h,l)),this.moveToTail(a)}if(0===s||0!==this.ttl||this.ttls||this.initializeTTLTracking(),o||this.setItemTTL(a,s),this.disposeAfter)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return this}newIndex(){return 0===this.size?this.tail:this.size===this.max?this.evict():0!==this.free.length?this.free.pop():this.initialFill++}pop(){if(this.size){const t=this.valList[this.head];return this.evict(),t}}evict(){const t=this.head,i=this.keyList[t],s=this.valList[t];return this.dispose(s,i,"evict"),this.disposeAfter&&this.disposed.push([s,i,"evict"]),this.removeItemSize(t),this.head=this.next[t],this.keyMap.delete(i),this.size--,t}has(t){return this.keyMap.has(t)&&!this.isStale(this.keyMap.get(t))}peek(t,{allowStale:i=this.allowStale}={}){const s=this.keyMap.get(t);if(void 0!==s&&(i||!this.isStale(s)))return this.valList[s]}get(t,{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet}={}){const e=this.keyMap.get(t);if(void 0!==e){if(this.isStale(e)){const s=i?this.valList[e]:void 0;return this.delete(t),s}return this.moveToTail(e),s&&this.updateItemAge(e),this.valList[e]}}connect(t,i){this.prev[i]=t,this.next[t]=i}moveToTail(t){t!==this.tail&&(t===this.head?this.head=this.next[t]:this.connect(this.prev[t],this.next[t]),this.connect(this.tail,t),this.tail=t)}get del(){return h("del","delete"),this.delete}delete(t){let i=!1;if(0!==this.size){const s=this.keyMap.get(t);void 0!==s&&(i=!0,1===this.size?this.clear():(this.removeItemSize(s),this.dispose(this.valList[s],t,"delete"),this.disposeAfter&&this.disposed.push([this.valList[s],t,"delete"]),this.keyMap.delete(t),this.keyList[s]=null,this.valList[s]=null,s===this.tail?this.tail=this.prev[s]:s===this.head?this.head=this.next[s]:(this.next[this.prev[s]]=this.next[s],this.prev[this.next[s]]=this.prev[s]),this.size--,this.free.push(s)))}if(this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return i}clear(){if(this.dispose!==d.prototype.dispose)for(const t of this.rindexes({allowStale:!0}))this.dispose(this.valList[t],this.keyList[t],"delete");if(this.disposeAfter)for(const t of this.rindexes({allowStale:!0}))this.disposed.push([this.valList[t],this.keyList[t],"delete"]);if(this.keyMap.clear(),this.valList.fill(null),this.keyList.fill(null),this.ttls&&(this.ttls.fill(0),this.starts.fill(0)),this.sizes&&this.sizes.fill(0),this.head=0,this.tail=0,this.initialFill=1,this.free.length=0,this.calculatedSize=0,this.size=0,this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift())}get reset(){return h("reset","clear"),this.clear}get length(){return((t,i)=>{const s="LRU_CACHE_PROPERTY_length";if(l(s)){const{prototype:i}=d,{get:e}=Object.getOwnPropertyDescriptor(i,t);o(s,"length property","cache.size",e)}})("length"),this.size}}t.exports=d}},i={},s=function s(e){var h=i[e];if(void 0!==h)return h.exports;var l=i[e]={exports:{}};return t[e](l,l.exports,s),l.exports}(10);module.exports=s})();
\ No newline at end of file
diff --git a/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/index.js b/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/index.js
index e9b2f37013e72e..77adaa6451a0c0 100644
--- a/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/index.js
+++ b/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/index.js
@@ -24,7 +24,9 @@ const deprecatedProperty = (field, instead) => {
warn(code, `${field} property`, `cache.${instead}`, get)
}
}
-const shouldWarn = (code) => !(process.noDeprecation || warned.has(code))
+const shouldWarn = (code) => typeof process === 'object' &&
+ process &&
+ !(process.noDeprecation || warned.has(code))
const warn = (code, what, instead, fn) => {
warned.add(code)
process.emitWarning(`The ${what} is deprecated. Please use ${instead} instead.`, 'DeprecationWarning', code, fn)
@@ -239,10 +241,10 @@ class LRUCache {
removeItemSize (index) {}
addItemSize (index, v, k, size, sizeCalculation) {}
- *indexes () {
+ *indexes ({ allowStale = this.allowStale } = {}) {
if (this.size) {
for (let i = this.tail; true; i = this.prev[i]) {
- if (!this.isStale(i)) {
+ if (allowStale || !this.isStale(i)) {
yield i
}
if (i === this.head) {
@@ -251,10 +253,10 @@ class LRUCache {
}
}
}
- *rindexes () {
+ *rindexes ({ allowStale = this.allowStale } = {}) {
if (this.size) {
for (let i = this.head; true; i = this.next[i]) {
- if (!this.isStale(i)) {
+ if (allowStale || !this.isStale(i)) {
yield i
}
if (i === this.tail) {
@@ -313,16 +315,10 @@ class LRUCache {
purgeStale () {
let deleted = false
- if (this.size) {
- for (let i = this.head; true; i = this.next[i]) {
- const b = i === this.tail
- if (this.isStale(i)) {
- this.delete(this.keyList[i])
- deleted = true
- }
- if (b) {
- break
- }
+ for (const i of this.rindexes({ allowStale: true })) {
+ if (this.isStale(i)) {
+ this.delete(this.keyList[i])
+ deleted = true
}
}
return deleted
@@ -542,12 +538,12 @@ class LRUCache {
clear () {
if (this.dispose !== LRUCache.prototype.dispose) {
- for (const index of this.rindexes()) {
+ for (const index of this.rindexes({ allowStale: true })) {
this.dispose(this.valList[index], this.keyList[index], 'delete')
}
}
if (this.disposeAfter) {
- for (const index of this.rindexes()) {
+ for (const index of this.rindexes({ allowStale: true })) {
this.disposed.push([this.valList[index], this.keyList[index], 'delete'])
}
}
diff --git a/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/package.json b/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/package.json
index ae92116975dc96..313bfcbbfd206c 100644
--- a/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/package.json
+++ b/deps/npm/node_modules/make-fetch-happen/node_modules/lru-cache/package.json
@@ -1,7 +1,7 @@
{
"name": "lru-cache",
"description": "A cache object that deletes the least-recently-used items.",
- "version": "7.4.0",
+ "version": "7.4.2",
"author": "Isaac Z. Schlueter ",
"keywords": [
"mru",
diff --git a/deps/npm/node_modules/make-fetch-happen/package.json b/deps/npm/node_modules/make-fetch-happen/package.json
index b871b18e09766c..c8c5842b33a9ff 100644
--- a/deps/npm/node_modules/make-fetch-happen/package.json
+++ b/deps/npm/node_modules/make-fetch-happen/package.json
@@ -1,6 +1,6 @@
{
"name": "make-fetch-happen",
- "version": "10.0.4",
+ "version": "10.0.5",
"description": "Opinionated, caching, retrying fetch client",
"main": "lib/index.js",
"files": [
@@ -39,10 +39,10 @@
"http-proxy-agent": "^5.0.0",
"https-proxy-agent": "^5.0.0",
"is-lambda": "^1.0.1",
- "lru-cache": "^7.4.0",
+ "lru-cache": "^7.4.1",
"minipass": "^3.1.6",
"minipass-collect": "^1.0.2",
- "minipass-fetch": "^2.0.1",
+ "minipass-fetch": "^2.0.2",
"minipass-flush": "^1.0.5",
"minipass-pipeline": "^1.2.4",
"negotiator": "^0.6.3",
@@ -51,7 +51,7 @@
"ssri": "^8.0.1"
},
"devDependencies": {
- "@npmcli/template-oss": "^2.8.1",
+ "@npmcli/template-oss": "^2.9.2",
"eslint": "^8.10.0",
"mkdirp": "^1.0.4",
"nock": "^13.2.4",
@@ -69,6 +69,6 @@
"check-coverage": true
},
"templateOSS": {
- "version": "2.8.1"
+ "version": "2.9.2"
}
}
diff --git a/deps/npm/node_modules/read-package-json/package.json b/deps/npm/node_modules/read-package-json/package.json
index fb263fd711ee7f..c86cf45f36d555 100644
--- a/deps/npm/node_modules/read-package-json/package.json
+++ b/deps/npm/node_modules/read-package-json/package.json
@@ -1,6 +1,6 @@
{
"name": "read-package-json",
- "version": "4.1.1",
+ "version": "4.1.2",
"author": "Isaac Z. Schlueter (http://blog.izs.me/)",
"description": "The thing npm uses to read package.json files with semantics and defaults and validation",
"repository": {
diff --git a/deps/npm/node_modules/read-package-json/read-json.js b/deps/npm/node_modules/read-package-json/read-json.js
index 468a33e3977742..cb2b4955215700 100644
--- a/deps/npm/node_modules/read-package-json/read-json.js
+++ b/deps/npm/node_modules/read-package-json/read-json.js
@@ -522,6 +522,10 @@ function final (file, data, log, strict, cb) {
function fillTypes (file, data, cb) {
var index = data.main ? data.main : 'index.js'
+ if (typeof index !== 'string') {
+ return cb(new TypeError('The "main" attribute must be of type string.'))
+ }
+
// TODO exports is much more complicated than this in verbose format
// We need to support for instance
diff --git a/deps/npm/package.json b/deps/npm/package.json
index 1d535ac05cd56c..d7e2f8b03fa064 100644
--- a/deps/npm/package.json
+++ b/deps/npm/package.json
@@ -1,5 +1,5 @@
{
- "version": "8.5.3",
+ "version": "8.5.4",
"name": "npm",
"description": "a package manager for JavaScript",
"workspaces": [
@@ -55,10 +55,10 @@
},
"dependencies": {
"@isaacs/string-locale-compare": "^1.1.0",
- "@npmcli/arborist": "^5.0.0",
+ "@npmcli/arborist": "^5.0.2",
"@npmcli/ci-detect": "^2.0.0",
"@npmcli/config": "^4.0.1",
- "@npmcli/map-workspaces": "^2.0.0",
+ "@npmcli/map-workspaces": "^2.0.2",
"@npmcli/package-json": "^1.0.1",
"@npmcli/run-script": "^3.0.1",
"abbrev": "~1.1.1",
@@ -79,18 +79,18 @@
"init-package-json": "^3.0.0",
"is-cidr": "^4.0.2",
"json-parse-even-better-errors": "^2.3.1",
- "libnpmaccess": "^6.0.0",
- "libnpmdiff": "^4.0.0",
- "libnpmexec": "^4.0.0",
- "libnpmfund": "^3.0.0",
- "libnpmhook": "^8.0.0",
- "libnpmorg": "^4.0.0",
- "libnpmpack": "^4.0.0",
- "libnpmpublish": "^6.0.0",
- "libnpmsearch": "^5.0.0",
- "libnpmteam": "^4.0.0",
- "libnpmversion": "^3.0.0",
- "make-fetch-happen": "^10.0.4",
+ "libnpmaccess": "^6.0.1",
+ "libnpmdiff": "^4.0.1",
+ "libnpmexec": "^4.0.1",
+ "libnpmfund": "^3.0.1",
+ "libnpmhook": "^8.0.1",
+ "libnpmorg": "^4.0.1",
+ "libnpmpack": "^4.0.1",
+ "libnpmpublish": "^6.0.1",
+ "libnpmsearch": "^5.0.1",
+ "libnpmteam": "^4.0.1",
+ "libnpmversion": "^3.0.1",
+ "make-fetch-happen": "^10.0.5",
"minipass": "^3.1.6",
"minipass-pipeline": "^1.2.4",
"mkdirp": "^1.0.4",
@@ -112,7 +112,7 @@
"proc-log": "^2.0.0",
"qrcode-terminal": "^0.12.0",
"read": "~1.0.7",
- "read-package-json": "^4.1.1",
+ "read-package-json": "^4.1.2",
"read-package-json-fast": "^2.0.3",
"readdir-scoped-modules": "^1.1.0",
"rimraf": "^3.0.2",
@@ -204,6 +204,7 @@
"@npmcli/template-oss": "^2.9.2",
"eslint": "^8.3.0",
"licensee": "^8.2.0",
+ "nock": "^13.2.4",
"spawk": "^1.7.1",
"tap": "^15.1.6"
},
diff --git a/deps/npm/tap-snapshots/test/lib/commands/doctor.js.test.cjs b/deps/npm/tap-snapshots/test/lib/commands/doctor.js.test.cjs
new file mode 100644
index 00000000000000..a28654e5d9b29d
--- /dev/null
+++ b/deps/npm/tap-snapshots/test/lib/commands/doctor.js.test.cjs
@@ -0,0 +1,1449 @@
+/* IMPORTANT
+ * This snapshot file is auto-generated, but designed for humans.
+ * It should be checked into source control and tracked carefully.
+ * Re-generate by setting TAP_SNAPSHOT=1 and running tests.
+ * Make sure to inspect the output below. Do not ignore changes!
+ */
+'use strict'
+exports[`test/lib/commands/doctor.js TAP all clear > logs 1`] = `
+Object {
+ "error": Array [],
+ "info": Array [
+ Array [
+ "Running checkup",
+ ],
+ Array [
+ "checkPing",
+ "Pinging registry",
+ ],
+ Array [
+ "getLatestNpmVersion",
+ "Getting npm package information",
+ ],
+ Array [
+ "getLatestNodejsVersion",
+ "Getting Node.js release information",
+ ],
+ Array [
+ "getGitPath",
+ "Finding git in your PATH",
+ ],
+ Array [
+ "verifyCachedFiles",
+ "Verifying the npm cache",
+ ],
+ Array [
+ "verifyCachedFiles",
+ String(
+ Verification complete. Stats: {
+ "badContentCount": 0,
+ "reclaimedCount": 0,
+ "missingContent": 0,
+ "verifiedContent": 0
+ }
+ ),
+ ],
+ ],
+ "warn": Array [],
+}
+`
+
+exports[`test/lib/commands/doctor.js TAP all clear > output 1`] = `
+Check Value Recommendation/Notes
+npm ping ok
+npm -v ok current: v1.0.0, latest: v1.0.0
+node -v ok current: v1.0.0, recommended: v1.0.0
+npm config get registry ok using default registry (https://registry.npmjs.org/)
+which git ok /path/to/git
+Perms check on cached files ok
+Perms check on local node_modules ok
+Perms check on global node_modules ok
+Perms check on local bin folder ok
+Perms check on global bin folder ok
+Verify cache contents ok verified 0 tarballs
+`
+
+exports[`test/lib/commands/doctor.js TAP all clear in color > everything is ok in color 1`] = `
+[4mCheck[24m [4mValue[24m [4mRecommendation/Notes[24m
+npm ping [32mok[39m
+npm -v [32mok[39m current: v1.0.0, latest: v1.0.0
+node -v [32mok[39m current: v1.0.0, recommended: v1.0.0
+npm config get registry [32mok[39m using default registry (https://registry.npmjs.org/)
+which git [32mok[39m /path/to/git
+Perms check on cached files [32mok[39m
+Perms check on local node_modules [32mok[39m
+Perms check on global node_modules [32mok[39m
+Perms check on local bin folder [32mok[39m
+Perms check on global bin folder [32mok[39m
+Verify cache contents [32mok[39m verified 0 tarballs
+`
+
+exports[`test/lib/commands/doctor.js TAP all clear in color > logs 1`] = `
+Object {
+ "error": Array [],
+ "info": Array [
+ Array [
+ "Running checkup",
+ ],
+ Array [
+ "checkPing",
+ "Pinging registry",
+ ],
+ Array [
+ "getLatestNpmVersion",
+ "Getting npm package information",
+ ],
+ Array [
+ "getLatestNodejsVersion",
+ "Getting Node.js release information",
+ ],
+ Array [
+ "getGitPath",
+ "Finding git in your PATH",
+ ],
+ Array [
+ "verifyCachedFiles",
+ "Verifying the npm cache",
+ ],
+ Array [
+ "verifyCachedFiles",
+ String(
+ Verification complete. Stats: {
+ "badContentCount": 0,
+ "reclaimedCount": 0,
+ "missingContent": 0,
+ "verifiedContent": 0
+ }
+ ),
+ ],
+ ],
+ "warn": Array [],
+}
+`
+
+exports[`test/lib/commands/doctor.js TAP bad proxy > logs 1`] = `
+Object {
+ "error": Array [],
+ "info": Array [
+ Array [
+ "Running checkup",
+ ],
+ Array [
+ "checkPing",
+ "Pinging registry",
+ ],
+ Array [
+ "getLatestNpmVersion",
+ "Getting npm package information",
+ ],
+ Array [
+ "getLatestNodejsVersion",
+ "Getting Node.js release information",
+ ],
+ Array [
+ "getGitPath",
+ "Finding git in your PATH",
+ ],
+ Array [
+ "verifyCachedFiles",
+ "Verifying the npm cache",
+ ],
+ Array [
+ "verifyCachedFiles",
+ String(
+ Verification complete. Stats: {
+ "badContentCount": 0,
+ "reclaimedCount": 0,
+ "missingContent": 0,
+ "verifiedContent": 0
+ }
+ ),
+ ],
+ ],
+ "warn": Array [],
+}
+`
+
+exports[`test/lib/commands/doctor.js TAP bad proxy > output 1`] = `
+Check Value Recommendation/Notes
+npm ping not ok unsupported proxy protocol: 'ssh:'
+npm -v not ok Error: unsupported proxy protocol: 'ssh:'
+node -v not ok Error: unsupported proxy protocol: 'ssh:'
+npm config get registry ok using default registry (https://registry.npmjs.org/)
+which git ok /path/to/git
+Perms check on cached files ok
+Perms check on local node_modules ok
+Perms check on global node_modules ok
+Perms check on local bin folder ok
+Perms check on global bin folder ok
+Verify cache contents ok verified 0 tarballs
+`
+
+exports[`test/lib/commands/doctor.js TAP cacache badContent > corrupted cache content 1`] = `
+Check Value Recommendation/Notes
+npm ping ok
+npm -v ok current: v1.0.0, latest: v1.0.0
+node -v ok current: v1.0.0, recommended: v1.0.0
+npm config get registry ok using default registry (https://registry.npmjs.org/)
+which git ok /path/to/git
+Perms check on cached files ok
+Perms check on local node_modules ok
+Perms check on global node_modules ok
+Perms check on local bin folder ok
+Perms check on global bin folder ok
+Verify cache contents ok verified 2 tarballs
+`
+
+exports[`test/lib/commands/doctor.js TAP cacache badContent > logs 1`] = `
+Object {
+ "error": Array [],
+ "info": Array [
+ Array [
+ "Running checkup",
+ ],
+ Array [
+ "checkPing",
+ "Pinging registry",
+ ],
+ Array [
+ "getLatestNpmVersion",
+ "Getting npm package information",
+ ],
+ Array [
+ "getLatestNodejsVersion",
+ "Getting Node.js release information",
+ ],
+ Array [
+ "getGitPath",
+ "Finding git in your PATH",
+ ],
+ Array [
+ "verifyCachedFiles",
+ "Verifying the npm cache",
+ ],
+ Array [
+ "verifyCachedFiles",
+ String(
+ Verification complete. Stats: {
+ "badContentCount": 1,
+ "reclaimedCount": 0,
+ "missingContent": 0,
+ "verifiedContent": 2
+ }
+ ),
+ ],
+ ],
+ "warn": Array [
+ Array [
+ "verifyCachedFiles",
+ "Corrupted content removed: 1",
+ ],
+ Array [
+ "verifyCachedFiles",
+ "Cache issues have been fixed",
+ ],
+ ],
+}
+`
+
+exports[`test/lib/commands/doctor.js TAP cacache missingContent > logs 1`] = `
+Object {
+ "error": Array [],
+ "info": Array [
+ Array [
+ "Running checkup",
+ ],
+ Array [
+ "checkPing",
+ "Pinging registry",
+ ],
+ Array [
+ "getLatestNpmVersion",
+ "Getting npm package information",
+ ],
+ Array [
+ "getLatestNodejsVersion",
+ "Getting Node.js release information",
+ ],
+ Array [
+ "getGitPath",
+ "Finding git in your PATH",
+ ],
+ Array [
+ "verifyCachedFiles",
+ "Verifying the npm cache",
+ ],
+ Array [
+ "verifyCachedFiles",
+ String(
+ Verification complete. Stats: {
+ "badContentCount": 0,
+ "reclaimedCount": 0,
+ "missingContent": 1,
+ "verifiedContent": 2
+ }
+ ),
+ ],
+ ],
+ "warn": Array [
+ Array [
+ "verifyCachedFiles",
+ "Missing content: 1",
+ ],
+ Array [
+ "verifyCachedFiles",
+ "Cache issues have been fixed",
+ ],
+ ],
+}
+`
+
+exports[`test/lib/commands/doctor.js TAP cacache missingContent > missing content 1`] = `
+Check Value Recommendation/Notes
+npm ping ok
+npm -v ok current: v1.0.0, latest: v1.0.0
+node -v ok current: v1.0.0, recommended: v1.0.0
+npm config get registry ok using default registry (https://registry.npmjs.org/)
+which git ok /path/to/git
+Perms check on cached files ok
+Perms check on local node_modules ok
+Perms check on global node_modules ok
+Perms check on local bin folder ok
+Perms check on global bin folder ok
+Verify cache contents ok verified 2 tarballs
+`
+
+exports[`test/lib/commands/doctor.js TAP cacache reclaimedCount > content garbage collected 1`] = `
+Check Value Recommendation/Notes
+npm ping ok
+npm -v ok current: v1.0.0, latest: v1.0.0
+node -v ok current: v1.0.0, recommended: v1.0.0
+npm config get registry ok using default registry (https://registry.npmjs.org/)
+which git ok /path/to/git
+Perms check on cached files ok
+Perms check on local node_modules ok
+Perms check on global node_modules ok
+Perms check on local bin folder ok
+Perms check on global bin folder ok
+Verify cache contents ok verified 2 tarballs
+`
+
+exports[`test/lib/commands/doctor.js TAP cacache reclaimedCount > logs 1`] = `
+Object {
+ "error": Array [],
+ "info": Array [
+ Array [
+ "Running checkup",
+ ],
+ Array [
+ "checkPing",
+ "Pinging registry",
+ ],
+ Array [
+ "getLatestNpmVersion",
+ "Getting npm package information",
+ ],
+ Array [
+ "getLatestNodejsVersion",
+ "Getting Node.js release information",
+ ],
+ Array [
+ "getGitPath",
+ "Finding git in your PATH",
+ ],
+ Array [
+ "verifyCachedFiles",
+ "Verifying the npm cache",
+ ],
+ Array [
+ "verifyCachedFiles",
+ String(
+ Verification complete. Stats: {
+ "badContentCount": 0,
+ "reclaimedCount": 1,
+ "missingContent": 0,
+ "verifiedContent": 2
+ }
+ ),
+ ],
+ ],
+ "warn": Array [
+ Array [
+ "verifyCachedFiles",
+ "Content garbage-collected: 1 (undefined bytes)",
+ ],
+ Array [
+ "verifyCachedFiles",
+ "Cache issues have been fixed",
+ ],
+ ],
+}
+`
+
+exports[`test/lib/commands/doctor.js TAP error reading directory > logs 1`] = `
+Object {
+ "error": Array [],
+ "info": Array [
+ Array [
+ "Running checkup",
+ ],
+ Array [
+ "checkPing",
+ "Pinging registry",
+ ],
+ Array [
+ "getLatestNpmVersion",
+ "Getting npm package information",
+ ],
+ Array [
+ "getLatestNodejsVersion",
+ "Getting Node.js release information",
+ ],
+ Array [
+ "getGitPath",
+ "Finding git in your PATH",
+ ],
+ Array [
+ "verifyCachedFiles",
+ "Verifying the npm cache",
+ ],
+ Array [
+ "verifyCachedFiles",
+ String(
+ Verification complete. Stats: {
+ "badContentCount": 0,
+ "reclaimedCount": 0,
+ "missingContent": 0,
+ "verifiedContent": 0
+ }
+ ),
+ ],
+ ],
+ "warn": Array [
+ Array [
+ "checkFilesPermission",
+ "error reading directory {CWD}/test/lib/commands/tap-testdir-doctor-error-reading-directory/cache",
+ ],
+ Array [
+ "checkFilesPermission",
+ "error reading directory {CWD}/test/lib/commands/tap-testdir-doctor-error-reading-directory/prefix/node_modules",
+ ],
+ Array [
+ "checkFilesPermission",
+ "error reading directory {CWD}/test/lib/commands/tap-testdir-doctor-error-reading-directory/global/lib/node_modules",
+ ],
+ Array [
+ "checkFilesPermission",
+ "error reading directory {CWD}/test/lib/commands/tap-testdir-doctor-error-reading-directory/prefix/node_modules/.bin",
+ ],
+ Array [
+ "checkFilesPermission",
+ "error reading directory {CWD}/test/lib/commands/tap-testdir-doctor-error-reading-directory/global/bin",
+ ],
+ ],
+}
+`
+
+exports[`test/lib/commands/doctor.js TAP error reading directory > readdir error 1`] = `
+Check Value Recommendation/Notes
+npm ping ok
+npm -v ok current: v1.0.0, latest: v1.0.0
+node -v ok current: v1.0.0, recommended: v1.0.0
+npm config get registry ok using default registry (https://registry.npmjs.org/)
+which git ok /path/to/git
+Perms check on cached files not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-error-reading-directory/cache (should be owned by current user)
+Perms check on local node_modules not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-error-reading-directory/prefix/node_modules (should be owned by current user)
+Perms check on global node_modules not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-error-reading-directory/global/lib/node_modules
+Perms check on local bin folder not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-error-reading-directory/prefix/node_modules/.bin
+Perms check on global bin folder not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-error-reading-directory/global/bin
+Verify cache contents ok verified 0 tarballs
+`
+
+exports[`test/lib/commands/doctor.js TAP incorrect owner > incorrect owner 1`] = `
+Check Value Recommendation/Notes
+npm ping ok
+npm -v ok current: v1.0.0, latest: v1.0.0
+node -v ok current: v1.0.0, recommended: v1.0.0
+npm config get registry ok using default registry (https://registry.npmjs.org/)
+which git ok /path/to/git
+Perms check on cached files not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache (should be owned by current user)
+Perms check on local node_modules not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/prefix/node_modules (should be owned by current user)
+Perms check on global node_modules ok
+Perms check on local bin folder ok
+Perms check on global bin folder ok
+Verify cache contents ok verified 0 tarballs
+`
+
+exports[`test/lib/commands/doctor.js TAP incorrect owner > logs 1`] = `
+Object {
+ "error": Array [],
+ "info": Array [
+ Array [
+ "Running checkup",
+ ],
+ Array [
+ "checkPing",
+ "Pinging registry",
+ ],
+ Array [
+ "getLatestNpmVersion",
+ "Getting npm package information",
+ ],
+ Array [
+ "getLatestNodejsVersion",
+ "Getting Node.js release information",
+ ],
+ Array [
+ "getGitPath",
+ "Finding git in your PATH",
+ ],
+ Array [
+ "verifyCachedFiles",
+ "Verifying the npm cache",
+ ],
+ Array [
+ "verifyCachedFiles",
+ String(
+ Verification complete. Stats: {
+ "badContentCount": 0,
+ "reclaimedCount": 0,
+ "missingContent": 0,
+ "verifiedContent": 0
+ }
+ ),
+ ],
+ ],
+ "warn": Array [
+ Array [
+ "checkFilesPermission",
+ "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache",
+ ],
+ Array [
+ "checkFilesPermission",
+ "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache",
+ ],
+ Array [
+ "checkFilesPermission",
+ "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_logs",
+ ],
+ Array [
+ "checkFilesPermission",
+ "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2",
+ ],
+ Array [
+ "checkFilesPermission",
+ "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5",
+ ],
+ Array [
+ "checkFilesPermission",
+ "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/tmp",
+ ],
+ Array [
+ "checkFilesPermission",
+ "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_logs/{DATE}-debug-0.log",
+ ],
+ Array [
+ "checkFilesPermission",
+ "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512",
+ ],
+ Array [
+ "checkFilesPermission",
+ "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5/5e",
+ ],
+ Array [
+ "checkFilesPermission",
+ "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5/af",
+ ],
+ Array [
+ "checkFilesPermission",
+ "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512/{sha}",
+ ],
+ Array [
+ "checkFilesPermission",
+ "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512/{sha}",
+ ],
+ Array [
+ "checkFilesPermission",
+ "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5/5e/be",
+ ],
+ Array [
+ "checkFilesPermission",
+ "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5/af/03",
+ ],
+ Array [
+ "checkFilesPermission",
+ "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512/{sha}",
+ ],
+ Array [
+ "checkFilesPermission",
+ "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512/{sha}",
+ ],
+ Array [
+ "checkFilesPermission",
+ "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5/5e/be/ccdeeea0a01ebb0e365e566161f7c68ddcbbe04206d8542742d98875f03f",
+ ],
+ Array [
+ "checkFilesPermission",
+ "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/index-v5/af/03/5c781820370e585dc2323edbbc80669bf714da5b47d56510c7d0bd7521ee",
+ ],
+ Array [
+ "checkFilesPermission",
+ "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512/{sha}",
+ ],
+ Array [
+ "checkFilesPermission",
+ "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/cache/_cacache/content-v2/sha512/{sha}",
+ ],
+ Array [
+ "checkFilesPermission",
+ "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/prefix/node_modules",
+ ],
+ Array [
+ "checkFilesPermission",
+ "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/prefix/node_modules/.bin",
+ ],
+ Array [
+ "checkFilesPermission",
+ "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/prefix/node_modules/testDir",
+ ],
+ Array [
+ "checkFilesPermission",
+ "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/prefix/node_modules/testLink",
+ ],
+ Array [
+ "checkFilesPermission",
+ "should be owner of {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-owner/prefix/node_modules/testDir/testFile",
+ ],
+ ],
+}
+`
+
+exports[`test/lib/commands/doctor.js TAP incorrect permissions > incorrect owner 1`] = `
+Check Value Recommendation/Notes
+npm ping ok
+npm -v ok current: v1.0.0, latest: v1.0.0
+node -v ok current: v1.0.0, recommended: v1.0.0
+npm config get registry ok using default registry (https://registry.npmjs.org/)
+which git ok /path/to/git
+Perms check on cached files not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-permissions/cache (should be owned by current user)
+Perms check on local node_modules not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-permissions/prefix/node_modules (should be owned by current user)
+Perms check on global node_modules not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-permissions/global/lib/node_modules
+Perms check on local bin folder not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-permissions/prefix/node_modules/.bin
+Perms check on global bin folder not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-permissions/global/bin
+Verify cache contents ok verified 0 tarballs
+`
+
+exports[`test/lib/commands/doctor.js TAP incorrect permissions > logs 1`] = `
+Object {
+ "error": Array [
+ Array [
+ "checkFilesPermission",
+ "Missing permissions on {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-permissions/cache (expect: readable)",
+ ],
+ Array [
+ "checkFilesPermission",
+ "Missing permissions on {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-permissions/prefix/node_modules (expect: readable, writable)",
+ ],
+ Array [
+ "checkFilesPermission",
+ "Missing permissions on {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-permissions/global/lib/node_modules (expect: readable)",
+ ],
+ Array [
+ "checkFilesPermission",
+ "Missing permissions on {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-permissions/prefix/node_modules/.bin (expect: readable, writable, executable)",
+ ],
+ Array [
+ "checkFilesPermission",
+ "Missing permissions on {CWD}/test/lib/commands/tap-testdir-doctor-incorrect-permissions/global/bin (expect: executable)",
+ ],
+ ],
+ "info": Array [
+ Array [
+ "Running checkup",
+ ],
+ Array [
+ "checkPing",
+ "Pinging registry",
+ ],
+ Array [
+ "getLatestNpmVersion",
+ "Getting npm package information",
+ ],
+ Array [
+ "getLatestNodejsVersion",
+ "Getting Node.js release information",
+ ],
+ Array [
+ "getGitPath",
+ "Finding git in your PATH",
+ ],
+ Array [
+ "verifyCachedFiles",
+ "Verifying the npm cache",
+ ],
+ Array [
+ "verifyCachedFiles",
+ String(
+ Verification complete. Stats: {
+ "badContentCount": 0,
+ "reclaimedCount": 0,
+ "missingContent": 0,
+ "verifiedContent": 0
+ }
+ ),
+ ],
+ ],
+ "warn": Array [],
+}
+`
+
+exports[`test/lib/commands/doctor.js TAP missing git > logs 1`] = `
+Object {
+ "error": Array [],
+ "info": Array [
+ Array [
+ "Running checkup",
+ ],
+ Array [
+ "checkPing",
+ "Pinging registry",
+ ],
+ Array [
+ "getLatestNpmVersion",
+ "Getting npm package information",
+ ],
+ Array [
+ "getLatestNodejsVersion",
+ "Getting Node.js release information",
+ ],
+ Array [
+ "getGitPath",
+ "Finding git in your PATH",
+ ],
+ Array [
+ "verifyCachedFiles",
+ "Verifying the npm cache",
+ ],
+ Array [
+ "verifyCachedFiles",
+ String(
+ Verification complete. Stats: {
+ "badContentCount": 0,
+ "reclaimedCount": 0,
+ "missingContent": 0,
+ "verifiedContent": 0
+ }
+ ),
+ ],
+ ],
+ "warn": Array [
+ Array [
+ Error: test error,
+ ],
+ ],
+}
+`
+
+exports[`test/lib/commands/doctor.js TAP missing git > missing git 1`] = `
+Check Value Recommendation/Notes
+npm ping ok
+npm -v ok current: v1.0.0, latest: v1.0.0
+node -v ok current: v1.0.0, recommended: v1.0.0
+npm config get registry ok using default registry (https://registry.npmjs.org/)
+which git not ok Install git and ensure it's in your PATH.
+Perms check on cached files ok
+Perms check on local node_modules ok
+Perms check on global node_modules ok
+Perms check on local bin folder ok
+Perms check on global bin folder ok
+Verify cache contents ok verified 0 tarballs
+`
+
+exports[`test/lib/commands/doctor.js TAP missing global directories > logs 1`] = `
+Object {
+ "error": Array [],
+ "info": Array [
+ Array [
+ "Running checkup",
+ ],
+ Array [
+ "checkPing",
+ "Pinging registry",
+ ],
+ Array [
+ "getLatestNpmVersion",
+ "Getting npm package information",
+ ],
+ Array [
+ "getLatestNodejsVersion",
+ "Getting Node.js release information",
+ ],
+ Array [
+ "getGitPath",
+ "Finding git in your PATH",
+ ],
+ Array [
+ "verifyCachedFiles",
+ "Verifying the npm cache",
+ ],
+ Array [
+ "verifyCachedFiles",
+ String(
+ Verification complete. Stats: {
+ "badContentCount": 0,
+ "reclaimedCount": 0,
+ "missingContent": 0,
+ "verifiedContent": 0
+ }
+ ),
+ ],
+ ],
+ "warn": Array [
+ Array [
+ "checkFilesPermission",
+ "error getting info for {CWD}/test/lib/commands/tap-testdir-doctor-missing-global-directories/global/lib/node_modules",
+ ],
+ Array [
+ "checkFilesPermission",
+ "error getting info for {CWD}/test/lib/commands/tap-testdir-doctor-missing-global-directories/global/bin",
+ ],
+ ],
+}
+`
+
+exports[`test/lib/commands/doctor.js TAP missing global directories > missing global directories 1`] = `
+Check Value Recommendation/Notes
+npm ping ok
+npm -v ok current: v1.0.0, latest: v1.0.0
+node -v ok current: v1.0.0, recommended: v1.0.0
+npm config get registry ok using default registry (https://registry.npmjs.org/)
+which git ok /path/to/git
+Perms check on cached files ok
+Perms check on local node_modules ok
+Perms check on global node_modules not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-missing-global-directories/global/lib/node_modules
+Perms check on local bin folder ok
+Perms check on global bin folder not ok Check the permissions of files in {CWD}/test/lib/commands/tap-testdir-doctor-missing-global-directories/global/bin
+Verify cache contents ok verified 0 tarballs
+`
+
+exports[`test/lib/commands/doctor.js TAP missing local node_modules > logs 1`] = `
+Object {
+ "error": Array [],
+ "info": Array [
+ Array [
+ "Running checkup",
+ ],
+ Array [
+ "checkPing",
+ "Pinging registry",
+ ],
+ Array [
+ "getLatestNpmVersion",
+ "Getting npm package information",
+ ],
+ Array [
+ "getLatestNodejsVersion",
+ "Getting Node.js release information",
+ ],
+ Array [
+ "getGitPath",
+ "Finding git in your PATH",
+ ],
+ Array [
+ "verifyCachedFiles",
+ "Verifying the npm cache",
+ ],
+ Array [
+ "verifyCachedFiles",
+ String(
+ Verification complete. Stats: {
+ "badContentCount": 0,
+ "reclaimedCount": 0,
+ "missingContent": 0,
+ "verifiedContent": 0
+ }
+ ),
+ ],
+ ],
+ "warn": Array [],
+}
+`
+
+exports[`test/lib/commands/doctor.js TAP missing local node_modules > missing local node_modules 1`] = `
+Check Value Recommendation/Notes
+npm ping ok
+npm -v ok current: v1.0.0, latest: v1.0.0
+node -v ok current: v1.0.0, recommended: v1.0.0
+npm config get registry ok using default registry (https://registry.npmjs.org/)
+which git ok /path/to/git
+Perms check on cached files ok
+Perms check on local node_modules ok
+Perms check on global node_modules ok
+Perms check on local bin folder ok
+Perms check on global bin folder ok
+Verify cache contents ok verified 0 tarballs
+`
+
+exports[`test/lib/commands/doctor.js TAP node out of date - current > logs 1`] = `
+Object {
+ "error": Array [],
+ "info": Array [
+ Array [
+ "Running checkup",
+ ],
+ Array [
+ "checkPing",
+ "Pinging registry",
+ ],
+ Array [
+ "getLatestNpmVersion",
+ "Getting npm package information",
+ ],
+ Array [
+ "getLatestNodejsVersion",
+ "Getting Node.js release information",
+ ],
+ Array [
+ "getGitPath",
+ "Finding git in your PATH",
+ ],
+ Array [
+ "verifyCachedFiles",
+ "Verifying the npm cache",
+ ],
+ Array [
+ "verifyCachedFiles",
+ String(
+ Verification complete. Stats: {
+ "badContentCount": 0,
+ "reclaimedCount": 0,
+ "missingContent": 0,
+ "verifiedContent": 0
+ }
+ ),
+ ],
+ ],
+ "warn": Array [],
+}
+`
+
+exports[`test/lib/commands/doctor.js TAP node out of date - current > node is out of date 1`] = `
+Check Value Recommendation/Notes
+npm ping ok
+npm -v ok current: v1.0.0, latest: v1.0.0
+node -v not ok Use node v2.0.1 (current: v2.0.0)
+npm config get registry ok using default registry (https://registry.npmjs.org/)
+which git ok /path/to/git
+Perms check on cached files ok
+Perms check on local node_modules ok
+Perms check on global node_modules ok
+Perms check on local bin folder ok
+Perms check on global bin folder ok
+Verify cache contents ok verified 0 tarballs
+`
+
+exports[`test/lib/commands/doctor.js TAP node out of date - lts > logs 1`] = `
+Object {
+ "error": Array [],
+ "info": Array [
+ Array [
+ "Running checkup",
+ ],
+ Array [
+ "checkPing",
+ "Pinging registry",
+ ],
+ Array [
+ "getLatestNpmVersion",
+ "Getting npm package information",
+ ],
+ Array [
+ "getLatestNodejsVersion",
+ "Getting Node.js release information",
+ ],
+ Array [
+ "getGitPath",
+ "Finding git in your PATH",
+ ],
+ Array [
+ "verifyCachedFiles",
+ "Verifying the npm cache",
+ ],
+ Array [
+ "verifyCachedFiles",
+ String(
+ Verification complete. Stats: {
+ "badContentCount": 0,
+ "reclaimedCount": 0,
+ "missingContent": 0,
+ "verifiedContent": 0
+ }
+ ),
+ ],
+ ],
+ "warn": Array [],
+}
+`
+
+exports[`test/lib/commands/doctor.js TAP node out of date - lts > node is out of date 1`] = `
+Check Value Recommendation/Notes
+npm ping ok
+npm -v ok current: v1.0.0, latest: v1.0.0
+node -v not ok Use node v1.0.0 (current: v0.0.1)
+npm config get registry ok using default registry (https://registry.npmjs.org/)
+which git ok /path/to/git
+Perms check on cached files ok
+Perms check on local node_modules ok
+Perms check on global node_modules ok
+Perms check on local bin folder ok
+Perms check on global bin folder ok
+Verify cache contents ok verified 0 tarballs
+`
+
+exports[`test/lib/commands/doctor.js TAP non-default registry > logs 1`] = `
+Object {
+ "error": Array [],
+ "info": Array [
+ Array [
+ "Running checkup",
+ ],
+ Array [
+ "checkPing",
+ "Pinging registry",
+ ],
+ Array [
+ "getLatestNpmVersion",
+ "Getting npm package information",
+ ],
+ Array [
+ "getLatestNodejsVersion",
+ "Getting Node.js release information",
+ ],
+ Array [
+ "getGitPath",
+ "Finding git in your PATH",
+ ],
+ Array [
+ "verifyCachedFiles",
+ "Verifying the npm cache",
+ ],
+ Array [
+ "verifyCachedFiles",
+ String(
+ Verification complete. Stats: {
+ "badContentCount": 0,
+ "reclaimedCount": 0,
+ "missingContent": 0,
+ "verifiedContent": 0
+ }
+ ),
+ ],
+ ],
+ "warn": Array [],
+}
+`
+
+exports[`test/lib/commands/doctor.js TAP non-default registry > non default registry 1`] = `
+Check Value Recommendation/Notes
+npm ping ok
+npm -v ok current: v1.0.0, latest: v1.0.0
+node -v ok current: v1.0.0, recommended: v1.0.0
+npm config get registry not ok Try \`npm config set registry=https://registry.npmjs.org/\`
+which git ok /path/to/git
+Perms check on cached files ok
+Perms check on local node_modules ok
+Perms check on global node_modules ok
+Perms check on local bin folder ok
+Perms check on global bin folder ok
+Verify cache contents ok verified 0 tarballs
+`
+
+exports[`test/lib/commands/doctor.js TAP npm out of date > logs 1`] = `
+Object {
+ "error": Array [],
+ "info": Array [
+ Array [
+ "Running checkup",
+ ],
+ Array [
+ "checkPing",
+ "Pinging registry",
+ ],
+ Array [
+ "getLatestNpmVersion",
+ "Getting npm package information",
+ ],
+ Array [
+ "getLatestNodejsVersion",
+ "Getting Node.js release information",
+ ],
+ Array [
+ "getGitPath",
+ "Finding git in your PATH",
+ ],
+ Array [
+ "verifyCachedFiles",
+ "Verifying the npm cache",
+ ],
+ Array [
+ "verifyCachedFiles",
+ String(
+ Verification complete. Stats: {
+ "badContentCount": 0,
+ "reclaimedCount": 0,
+ "missingContent": 0,
+ "verifiedContent": 0
+ }
+ ),
+ ],
+ ],
+ "warn": Array [],
+}
+`
+
+exports[`test/lib/commands/doctor.js TAP npm out of date > npm is out of date 1`] = `
+Check Value Recommendation/Notes
+npm ping ok
+npm -v not ok Use npm v2.0.0
+node -v ok current: v1.0.0, recommended: v1.0.0
+npm config get registry ok using default registry (https://registry.npmjs.org/)
+which git ok /path/to/git
+Perms check on cached files ok
+Perms check on local node_modules ok
+Perms check on global node_modules ok
+Perms check on local bin folder ok
+Perms check on global bin folder ok
+Verify cache contents ok verified 0 tarballs
+`
+
+exports[`test/lib/commands/doctor.js TAP ping 404 > logs 1`] = `
+Object {
+ "error": Array [],
+ "info": Array [
+ Array [
+ "Running checkup",
+ ],
+ Array [
+ "checkPing",
+ "Pinging registry",
+ ],
+ Array [
+ "getLatestNpmVersion",
+ "Getting npm package information",
+ ],
+ Array [
+ "getLatestNodejsVersion",
+ "Getting Node.js release information",
+ ],
+ Array [
+ "getGitPath",
+ "Finding git in your PATH",
+ ],
+ Array [
+ "verifyCachedFiles",
+ "Verifying the npm cache",
+ ],
+ Array [
+ "verifyCachedFiles",
+ String(
+ Verification complete. Stats: {
+ "badContentCount": 0,
+ "reclaimedCount": 0,
+ "missingContent": 0,
+ "verifiedContent": 0
+ }
+ ),
+ ],
+ ],
+ "warn": Array [],
+}
+`
+
+exports[`test/lib/commands/doctor.js TAP ping 404 > ping 404 1`] = `
+Check Value Recommendation/Notes
+npm ping not ok 404 404 Not Found - GET https://registry.npmjs.org/-/ping?write=true
+npm -v ok current: v1.0.0, latest: v1.0.0
+node -v ok current: v1.0.0, recommended: v1.0.0
+npm config get registry ok using default registry (https://registry.npmjs.org/)
+which git ok /path/to/git
+Perms check on cached files ok
+Perms check on local node_modules ok
+Perms check on global node_modules ok
+Perms check on local bin folder ok
+Perms check on global bin folder ok
+Verify cache contents ok verified 0 tarballs
+`
+
+exports[`test/lib/commands/doctor.js TAP ping 404 in color > logs 1`] = `
+Object {
+ "error": Array [],
+ "info": Array [
+ Array [
+ "Running checkup",
+ ],
+ Array [
+ "checkPing",
+ "Pinging registry",
+ ],
+ Array [
+ "getLatestNpmVersion",
+ "Getting npm package information",
+ ],
+ Array [
+ "getLatestNodejsVersion",
+ "Getting Node.js release information",
+ ],
+ Array [
+ "getGitPath",
+ "Finding git in your PATH",
+ ],
+ Array [
+ "verifyCachedFiles",
+ "Verifying the npm cache",
+ ],
+ Array [
+ "verifyCachedFiles",
+ String(
+ Verification complete. Stats: {
+ "badContentCount": 0,
+ "reclaimedCount": 0,
+ "missingContent": 0,
+ "verifiedContent": 0
+ }
+ ),
+ ],
+ ],
+ "warn": Array [],
+}
+`
+
+exports[`test/lib/commands/doctor.js TAP ping 404 in color > ping 404 in color 1`] = `
+[4mCheck[24m [4mValue[24m [4mRecommendation/Notes[24m
+[31mnpm ping[39m [31mnot ok[39m [35m404 404 Not Found - GET https://registry.npmjs.org/-/ping?write=true[39m
+npm -v [32mok[39m current: v1.0.0, latest: v1.0.0
+node -v [32mok[39m current: v1.0.0, recommended: v1.0.0
+npm config get registry [32mok[39m using default registry (https://registry.npmjs.org/)
+which git [32mok[39m /path/to/git
+Perms check on cached files [32mok[39m
+Perms check on local node_modules [32mok[39m
+Perms check on global node_modules [32mok[39m
+Perms check on local bin folder [32mok[39m
+Perms check on global bin folder [32mok[39m
+Verify cache contents [32mok[39m verified 0 tarballs
+`
+
+exports[`test/lib/commands/doctor.js TAP ping exception with code > logs 1`] = `
+Object {
+ "error": Array [],
+ "info": Array [
+ Array [
+ "Running checkup",
+ ],
+ Array [
+ "checkPing",
+ "Pinging registry",
+ ],
+ Array [
+ "getLatestNpmVersion",
+ "Getting npm package information",
+ ],
+ Array [
+ "getLatestNodejsVersion",
+ "Getting Node.js release information",
+ ],
+ Array [
+ "getGitPath",
+ "Finding git in your PATH",
+ ],
+ Array [
+ "verifyCachedFiles",
+ "Verifying the npm cache",
+ ],
+ Array [
+ "verifyCachedFiles",
+ String(
+ Verification complete. Stats: {
+ "badContentCount": 0,
+ "reclaimedCount": 0,
+ "missingContent": 0,
+ "verifiedContent": 0
+ }
+ ),
+ ],
+ ],
+ "warn": Array [],
+}
+`
+
+exports[`test/lib/commands/doctor.js TAP ping exception with code > ping failure 1`] = `
+Check Value Recommendation/Notes
+npm ping not ok request to https://registry.npmjs.org/-/ping?write=true failed, reason: Test Error
+npm -v ok current: v1.0.0, latest: v1.0.0
+node -v ok current: v1.0.0, recommended: v1.0.0
+npm config get registry ok using default registry (https://registry.npmjs.org/)
+which git ok /path/to/git
+Perms check on cached files ok
+Perms check on local node_modules ok
+Perms check on global node_modules ok
+Perms check on local bin folder ok
+Perms check on global bin folder ok
+Verify cache contents ok verified 0 tarballs
+`
+
+exports[`test/lib/commands/doctor.js TAP ping exception without code > logs 1`] = `
+Object {
+ "error": Array [],
+ "info": Array [
+ Array [
+ "Running checkup",
+ ],
+ Array [
+ "checkPing",
+ "Pinging registry",
+ ],
+ Array [
+ "getLatestNpmVersion",
+ "Getting npm package information",
+ ],
+ Array [
+ "getLatestNodejsVersion",
+ "Getting Node.js release information",
+ ],
+ Array [
+ "getGitPath",
+ "Finding git in your PATH",
+ ],
+ Array [
+ "verifyCachedFiles",
+ "Verifying the npm cache",
+ ],
+ Array [
+ "verifyCachedFiles",
+ String(
+ Verification complete. Stats: {
+ "badContentCount": 0,
+ "reclaimedCount": 0,
+ "missingContent": 0,
+ "verifiedContent": 0
+ }
+ ),
+ ],
+ ],
+ "warn": Array [],
+}
+`
+
+exports[`test/lib/commands/doctor.js TAP ping exception without code > ping failure 1`] = `
+Check Value Recommendation/Notes
+npm ping not ok request to https://registry.npmjs.org/-/ping?write=true failed, reason: Test Error
+npm -v ok current: v1.0.0, latest: v1.0.0
+node -v ok current: v1.0.0, recommended: v1.0.0
+npm config get registry ok using default registry (https://registry.npmjs.org/)
+which git ok /path/to/git
+Perms check on cached files ok
+Perms check on local node_modules ok
+Perms check on global node_modules ok
+Perms check on local bin folder ok
+Perms check on global bin folder ok
+Verify cache contents ok verified 0 tarballs
+`
+
+exports[`test/lib/commands/doctor.js TAP silent > logs 1`] = `
+Object {
+ "error": Array [],
+ "info": Array [
+ Array [
+ "Running checkup",
+ ],
+ Array [
+ "checkPing",
+ "Pinging registry",
+ ],
+ Array [
+ "getLatestNpmVersion",
+ "Getting npm package information",
+ ],
+ Array [
+ "getLatestNodejsVersion",
+ "Getting Node.js release information",
+ ],
+ Array [
+ "getGitPath",
+ "Finding git in your PATH",
+ ],
+ Array [
+ "verifyCachedFiles",
+ "Verifying the npm cache",
+ ],
+ Array [
+ "verifyCachedFiles",
+ String(
+ Verification complete. Stats: {
+ "badContentCount": 0,
+ "reclaimedCount": 0,
+ "missingContent": 0,
+ "verifiedContent": 0
+ }
+ ),
+ ],
+ ],
+ "warn": Array [],
+}
+`
+
+exports[`test/lib/commands/doctor.js TAP silent > output 1`] = `
+
+`
+
+exports[`test/lib/commands/doctor.js TAP windows skips permissions checks > logs 1`] = `
+Object {
+ "error": Array [],
+ "info": Array [
+ Array [
+ "Running checkup",
+ ],
+ Array [
+ "checkPing",
+ "Pinging registry",
+ ],
+ Array [
+ "getLatestNpmVersion",
+ "Getting npm package information",
+ ],
+ Array [
+ "getLatestNodejsVersion",
+ "Getting Node.js release information",
+ ],
+ Array [
+ "getGitPath",
+ "Finding git in your PATH",
+ ],
+ Array [
+ "verifyCachedFiles",
+ "Verifying the npm cache",
+ ],
+ Array [
+ "verifyCachedFiles",
+ String(
+ Verification complete. Stats: {
+ "badContentCount": 0,
+ "reclaimedCount": 0,
+ "missingContent": 0,
+ "verifiedContent": 0
+ }
+ ),
+ ],
+ ],
+ "warn": Array [],
+}
+`
+
+exports[`test/lib/commands/doctor.js TAP windows skips permissions checks > no permissions checks 1`] = `
+Check Value Recommendation/Notes
+npm ping ok
+npm -v ok current: v1.0.0, latest: v1.0.0
+node -v ok current: v1.0.0, recommended: v1.0.0
+npm config get registry ok using default registry (https://registry.npmjs.org/)
+which git ok /path/to/git
+Verify cache contents ok verified 0 tarballs
+`
diff --git a/deps/npm/tap-snapshots/test/lib/commands/shrinkwrap.js.test.cjs b/deps/npm/tap-snapshots/test/lib/commands/shrinkwrap.js.test.cjs
index ddc80a9350f0a6..dee5f8af83b0f2 100644
--- a/deps/npm/tap-snapshots/test/lib/commands/shrinkwrap.js.test.cjs
+++ b/deps/npm/tap-snapshots/test/lib/commands/shrinkwrap.js.test.cjs
@@ -16,7 +16,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with hidden lockfile ancient > must
},
"config": {},
"shrinkwrap": {
- "name": "root",
+ "name": "prefix",
"lockfileVersion": 1,
"requires": true
},
@@ -39,7 +39,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with hidden lockfile ancient upgrad
"lockfile-version": 3
},
"shrinkwrap": {
- "name": "root",
+ "name": "prefix",
"lockfileVersion": 3,
"requires": true,
"packages": {}
@@ -61,7 +61,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with hidden lockfile existing > mus
},
"config": {},
"shrinkwrap": {
- "name": "root",
+ "name": "prefix",
"lockfileVersion": 2,
"requires": true,
"packages": {}
@@ -85,7 +85,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with hidden lockfile existing downg
"lockfile-version": 1
},
"shrinkwrap": {
- "name": "root",
+ "name": "prefix",
"lockfileVersion": 1,
"requires": true
},
@@ -108,7 +108,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with hidden lockfile existing upgra
"lockfile-version": 3
},
"shrinkwrap": {
- "name": "root",
+ "name": "prefix",
"lockfileVersion": 3,
"requires": true,
"packages": {}
@@ -124,7 +124,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with nothing ancient > must match s
"localPrefix": {},
"config": {},
"shrinkwrap": {
- "name": "root",
+ "name": "prefix",
"lockfileVersion": 2,
"requires": true,
"packages": {}
@@ -142,7 +142,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with nothing ancient upgrade > must
"lockfile-version": 3
},
"shrinkwrap": {
- "name": "root",
+ "name": "prefix",
"lockfileVersion": 3,
"requires": true,
"packages": {}
@@ -162,12 +162,12 @@ exports[`test/lib/commands/shrinkwrap.js TAP with npm-shrinkwrap.json ancient >
},
"config": {},
"shrinkwrap": {
- "name": "root",
+ "name": "prefix",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
- "name": "root"
+ "name": "prefix"
}
}
},
@@ -188,12 +188,12 @@ exports[`test/lib/commands/shrinkwrap.js TAP with npm-shrinkwrap.json ancient up
"lockfile-version": 3
},
"shrinkwrap": {
- "name": "root",
+ "name": "prefix",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
- "name": "root"
+ "name": "prefix"
}
}
},
@@ -212,12 +212,12 @@ exports[`test/lib/commands/shrinkwrap.js TAP with npm-shrinkwrap.json existing >
},
"config": {},
"shrinkwrap": {
- "name": "root",
+ "name": "prefix",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
- "name": "root"
+ "name": "prefix"
}
}
},
@@ -238,7 +238,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with npm-shrinkwrap.json existing d
"lockfile-version": 1
},
"shrinkwrap": {
- "name": "root",
+ "name": "prefix",
"lockfileVersion": 1,
"requires": true
},
@@ -259,12 +259,12 @@ exports[`test/lib/commands/shrinkwrap.js TAP with npm-shrinkwrap.json existing u
"lockfile-version": 3
},
"shrinkwrap": {
- "name": "root",
+ "name": "prefix",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
- "name": "root"
+ "name": "prefix"
}
}
},
@@ -283,12 +283,12 @@ exports[`test/lib/commands/shrinkwrap.js TAP with package-lock.json ancient > mu
},
"config": {},
"shrinkwrap": {
- "name": "root",
+ "name": "prefix",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
- "name": "root"
+ "name": "prefix"
}
}
},
@@ -309,12 +309,12 @@ exports[`test/lib/commands/shrinkwrap.js TAP with package-lock.json ancient upgr
"lockfile-version": 3
},
"shrinkwrap": {
- "name": "root",
+ "name": "prefix",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
- "name": "root"
+ "name": "prefix"
}
}
},
@@ -333,12 +333,12 @@ exports[`test/lib/commands/shrinkwrap.js TAP with package-lock.json existing > m
},
"config": {},
"shrinkwrap": {
- "name": "root",
+ "name": "prefix",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
- "name": "root"
+ "name": "prefix"
}
}
},
@@ -359,7 +359,7 @@ exports[`test/lib/commands/shrinkwrap.js TAP with package-lock.json existing dow
"lockfile-version": 1
},
"shrinkwrap": {
- "name": "root",
+ "name": "prefix",
"lockfileVersion": 1,
"requires": true
},
@@ -380,12 +380,12 @@ exports[`test/lib/commands/shrinkwrap.js TAP with package-lock.json existing upg
"lockfile-version": 3
},
"shrinkwrap": {
- "name": "root",
+ "name": "prefix",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
- "name": "root"
+ "name": "prefix"
}
}
},
diff --git a/deps/npm/test/fixtures/clean-snapshot.js b/deps/npm/test/fixtures/clean-snapshot.js
index 037155eea186d6..b0ea28cee4d814 100644
--- a/deps/npm/test/fixtures/clean-snapshot.js
+++ b/deps/npm/test/fixtures/clean-snapshot.js
@@ -10,7 +10,7 @@ const cleanCwd = (path) => normalizePath(path)
.replace(new RegExp(normalizePath(process.cwd()), 'g'), '{CWD}')
const cleanDate = (str) =>
- str.replace(/\d{4}-\d{2}-\d{2}T\d{2}[_:]\d{2}[_:]\d{2}[_:]\d{3}Z/g, '{DATE}')
+ str.replace(/\d{4}-\d{2}-\d{2}T\d{2}[_:]\d{2}[_:]\d{2}[_:.]\d{3}Z/g, '{DATE}')
module.exports = {
normalizePath,
diff --git a/deps/npm/test/fixtures/mock-logs.js b/deps/npm/test/fixtures/mock-logs.js
index 80037c6ffa88d9..706c9a3050ac4e 100644
--- a/deps/npm/test/fixtures/mock-logs.js
+++ b/deps/npm/test/fixtures/mock-logs.js
@@ -60,7 +60,27 @@ const mockLogs = (otherMocks = {}) => {
return acc
}, {}),
// except collect timing logs
- { timing: (...args) => logs.push(['timing', ...args]) },
+ {
+ timing: (...args) => logs.push(['timing', ...args]),
+ newItem: () => {
+ return {
+ info: (...p) => {
+ logs.push(['info', ...p])
+ },
+ warn: (...p) => {
+ logs.push(['warn', ...p])
+ },
+ error: (...p) => {
+ logs.push(['error', ...p])
+ },
+ silly: (...p) => {
+ logs.push(['silly', ...p])
+ },
+ completeWork: () => {},
+ finish: () => {},
+ }
+ },
+ },
otherMocks.npmlog
)),
}
diff --git a/deps/npm/test/fixtures/mock-npm.js b/deps/npm/test/fixtures/mock-npm.js
index 4846d9a4858419..ea608d66444460 100644
--- a/deps/npm/test/fixtures/mock-npm.js
+++ b/deps/npm/test/fixtures/mock-npm.js
@@ -49,7 +49,9 @@ const result = (fn, ...args) => typeof fn === 'function' ? fn(...args) : fn
const LoadMockNpm = async (t, {
init = true,
load = init,
- testdir = {},
+ prefixDir = {},
+ cacheDir = {},
+ globalPrefixDir = {},
config = {},
mocks = {},
globals = null,
@@ -77,9 +79,10 @@ const LoadMockNpm = async (t, {
// Set log level as early as possible since
setLoglevel(t, config.loglevel)
- const dir = t.testdir({ root: testdir, cache: {} })
- const prefix = path.join(dir, 'root')
+ const dir = t.testdir({ prefix: prefixDir, cache: cacheDir, global: globalPrefixDir })
+ const prefix = path.join(dir, 'prefix')
const cache = path.join(dir, 'cache')
+ const globalPrefix = path.join(dir, 'global')
// Set cache to testdir via env var so it is available when load is run
// XXX: remove this for a solution where cache argv is passed in
@@ -104,6 +107,7 @@ const LoadMockNpm = async (t, {
setLoglevel(t, config.loglevel, false)
npm.prefix = prefix
npm.cache = cache
+ npm.globalPrefix = globalPrefix
}
return {
@@ -111,6 +115,7 @@ const LoadMockNpm = async (t, {
Npm,
npm,
prefix,
+ testdir: dir,
cache,
debugFile: async () => {
const readFiles = npm.logFiles.map(f => fs.readFile(f))
diff --git a/deps/npm/test/fixtures/tnock.js b/deps/npm/test/fixtures/tnock.js
new file mode 100644
index 00000000000000..c5acec510543d0
--- /dev/null
+++ b/deps/npm/test/fixtures/tnock.js
@@ -0,0 +1,15 @@
+'use strict'
+
+const nock = require('nock')
+
+// TODO (other tests actually make network calls today, which is bad)
+// nock.disableNetConnect()
+
+module.exports = tnock
+function tnock (t, host) {
+ const server = nock(host)
+ t.teardown(function () {
+ server.done()
+ })
+ return server
+}
diff --git a/deps/npm/test/lib/commands/access.js b/deps/npm/test/lib/commands/access.js
index 298897e4f5ffc6..81e29146b61021 100644
--- a/deps/npm/test/lib/commands/access.js
+++ b/deps/npm/test/lib/commands/access.js
@@ -61,7 +61,7 @@ t.test('edit', async t => {
t.test('access public on unscoped package', async t => {
const { npm } = await loadMockNpm(t, {
- testdir: {
+ prefixDir: {
'package.json': JSON.stringify({
name: 'npm-access-public-pkg',
}),
@@ -91,7 +91,7 @@ t.test('access public on scoped package', async t => {
},
},
},
- testdir: {
+ prefixDir: {
'package.json': JSON.stringify({ name }),
},
})
@@ -109,7 +109,7 @@ t.test('access public on missing package.json', async t => {
t.test('access public on invalid package.json', async t => {
const { npm } = await loadMockNpm(t, {
- testdir: {
+ prefixDir: {
'package.json': '{\n',
node_modules: {},
},
@@ -123,7 +123,7 @@ t.test('access public on invalid package.json', async t => {
t.test('access restricted on unscoped package', async t => {
const { npm } = await loadMockNpm(t, {
- testdir: {
+ prefixDir: {
'package.json': JSON.stringify({
name: 'npm-access-restricted-pkg',
}),
@@ -153,7 +153,7 @@ t.test('access restricted on scoped package', async t => {
},
},
},
- testdir: {
+ prefixDir: {
'package.json': JSON.stringify({ name }),
},
})
@@ -171,7 +171,7 @@ t.test('access restricted on missing package.json', async t => {
t.test('access restricted on invalid package.json', async t => {
const { npm } = await loadMockNpm(t, {
- testdir: {
+ prefixDir: {
'package.json': '{\n',
node_modules: {},
},
@@ -240,7 +240,7 @@ t.test('access grant current cwd', async t => {
},
},
},
- testdir: {
+ prefixDir: {
'package.json': JSON.stringify({
name: 'yargs',
}),
@@ -406,7 +406,7 @@ t.test('access ls-collaborators on current', async t => {
},
},
},
- testdir: {
+ prefixDir: {
'package.json': JSON.stringify({
name: 'yargs',
}),
diff --git a/deps/npm/test/lib/commands/completion.js b/deps/npm/test/lib/commands/completion.js
index dd571baf793a7f..045054b74ec7b2 100644
--- a/deps/npm/test/lib/commands/completion.js
+++ b/deps/npm/test/lib/commands/completion.js
@@ -42,7 +42,7 @@ const loadMockCompletionComp = async (t, word, line) =>
t.test('completion', async t => {
t.test('completion completion', async t => {
const { outputs, completion, prefix } = await loadMockCompletion(t, {
- testdir: {
+ prefixDir: {
'.bashrc': 'aaa',
'.zshrc': 'aaa',
},
diff --git a/deps/npm/test/lib/commands/doctor.js b/deps/npm/test/lib/commands/doctor.js
index dee2110ff3c89c..5badab99a1d56e 100644
--- a/deps/npm/test/lib/commands/doctor.js
+++ b/deps/npm/test/lib/commands/doctor.js
@@ -1,1022 +1,524 @@
const t = require('tap')
-
-const { join } = require('path')
const fs = require('fs')
-const ansiTrim = require('../../../lib/utils/ansi-trim.js')
-const isWindows = require('../../../lib/utils/is-windows.js')
-const { fake: mockNpm } = require('../../fixtures/mock-npm')
-// getuid and getgid do not exist in windows, so we shim them
-// to return 0, as that is the value that lstat will assign the
-// gid and uid properties for fs.Stats objects
-if (isWindows) {
- process.getuid = () => 0
- process.getgid = () => 0
-}
+const { load: loadMockNpm } = require('../../fixtures/mock-npm')
+const tnock = require('../../fixtures/tnock.js')
+const mockGlobals = require('../../fixtures/mock-globals')
+const { cleanCwd, cleanDate } = require('../../fixtures/clean-snapshot.js')
-const output = []
+const cleanCacheSha = (str) =>
+ str.replace(/content-v2\/sha512\/[^"]+/g, 'content-v2/sha512/{sha}')
-let pingError
-const ping = async () => {
- if (pingError) {
- throw pingError
- }
-}
+t.cleanSnapshot = p => cleanCacheSha(cleanDate(cleanCwd(p)))
-let whichError = null
-const which = async () => {
- if (whichError) {
- throw whichError
+const npmManifest = (version) => {
+ return {
+ name: 'npm',
+ versions: {
+ [version]: {
+ name: 'npm',
+ version: version,
+ },
+ },
+ time: {
+ [version]: new Date(),
+ },
+ 'dist-tags': { latest: version },
}
- return '/path/to/git'
}
const nodeVersions = [
- { version: 'v14.0.0', lts: false },
- { version: 'v13.0.0', lts: false },
- // it's necessary to allow tests in node 10.x to not mark 12.x as lts
- { version: 'v12.0.0', lts: false },
- { version: 'v10.13.0', lts: 'Dubnium' },
+ { version: 'v2.0.1', lts: false },
+ { version: 'v2.0.0', lts: false },
+ { version: 'v1.0.0', lts: 'NpmTestium' },
]
-const fetch = async () => {
- return {
- json: async () => {
- return nodeVersions
+const dirs = {
+ prefixDir: {
+ node_modules: {
+ testLink: t.fixture('symlink', './testDir'),
+ testDir: {
+ testFile: 'test contents',
+ },
+ '.bin': {},
},
- }
-}
-
-const logs = {
- info: [],
-}
-
-const clearLogs = () => {
- output.length = 0
- for (const key in logs) {
- if (Array.isArray(logs[key])) {
- logs[key].length = 0
- } else {
- delete logs[key]
- }
- }
-}
-
-const npm = mockNpm({
- flatOptions: {
- registry: 'https://registry.npmjs.org/',
- },
- config: {
- loglevel: 'info',
},
- version: '7.1.0',
- output: data => {
- output.push(data)
+ globalPrefixDir: {
+ bin: {},
+ lib: {
+ node_modules: {
+ },
+ },
},
+}
+
+let consoleError = false
+t.afterEach(() => {
+ consoleError = false
})
-let latestNpm = npm.version
-const pacote = {
- manifest: async () => {
- return { version: latestNpm }
+const globals = {
+ console: {
+ error: () => {
+ consoleError = true
+ },
+ },
+ process: {
+ platform: 'test-not-windows',
+ version: 'v1.0.0',
},
}
-let verifyResponse = { verifiedCount: 1, verifiedContent: 1 }
-const cacache = {
- verify: async () => {
- return verifyResponse
- },
+// getuid and getgid do not exist in windows, so we shim them
+// to return 0, as that is the value that lstat will assign the
+// gid and uid properties for fs.Stats objects
+if (process.platform === 'win32') {
+ mockGlobals(t, {
+ process: {
+ getuid: () => 0,
+ getgid: () => 0,
+ },
+ })
}
const mocks = {
- '../../../lib/utils/is-windows.js': false,
- '../../../lib/utils/ping.js': ping,
- cacache,
- pacote,
- 'make-fetch-happen': fetch,
- which,
- 'proc-log': {
- info: msg => {
- logs.info.push(msg)
+ '../../package.json': { version: '1.0.0' },
+ which: async () => '/path/to/git',
+ cacache: {
+ verify: () => {
+ return { badContentCount: 0, reclaimedCount: 0, missingContent: 0, verifiedContent: 0 }
},
},
- npmlog: {
- newItem: name => {
- logs[name] = {}
- return {
- info: (_, msg) => {
- if (!logs[name].info) {
- logs[name].info = []
- }
- logs[name].info.push(msg)
- },
- warn: (_, msg) => {
- if (!logs[name].warn) {
- logs[name].warn = []
- }
- logs[name].warn.push(msg)
- },
- error: (_, msg) => {
- if (!logs[name].error) {
- logs[name].error = []
- }
- logs[name].error.push(msg)
- },
- silly: (_, msg) => {
- if (!logs[name].silly) {
- logs[name].silly = []
- }
- logs[name].silly.push(msg)
- },
- completeWork: () => {},
- finish: () => {
- logs[name].finished = true
- },
- }
+}
+
+t.test('all clear', async t => {
+ const { joinedOutput, logs, npm } = await loadMockNpm(t, {
+ mocks,
+ globals,
+ ...dirs,
+ })
+ tnock(t, npm.config.get('registry'))
+ .get('/-/ping?write=true').reply(200, '{}')
+ .get('/npm').reply(200, npmManifest(npm.version))
+ tnock(t, 'https://nodejs.org')
+ .get('/dist/index.json').reply(200, nodeVersions)
+ await npm.exec('doctor', [])
+ t.matchSnapshot(joinedOutput(), 'output')
+ t.notOk(consoleError, 'console.error not called')
+ t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs')
+})
+
+t.test('all clear in color', async t => {
+ const { joinedOutput, logs, npm } = await loadMockNpm(t, {
+ mocks,
+ globals,
+ ...dirs,
+ })
+ tnock(t, npm.config.get('registry'))
+ .get('/-/ping?write=true').reply(200, '{}')
+ .get('/npm').reply(200, npmManifest(npm.version))
+ tnock(t, 'https://nodejs.org')
+ .get('/dist/index.json').reply(200, nodeVersions)
+ npm.config.set('color', 'always')
+ await npm.exec('doctor', [])
+ t.matchSnapshot(joinedOutput(), 'everything is ok in color')
+ t.notOk(consoleError, 'console.error not called')
+ t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs')
+})
+
+t.test('silent', async t => {
+ const { joinedOutput, logs, npm } = await loadMockNpm(t, {
+ mocks,
+ globals,
+ config: {
+ loglevel: 'silent',
+ },
+ ...dirs,
+ })
+ tnock(t, npm.config.get('registry'))
+ .get('/-/ping?write=true').reply(200, '{}')
+ .get('/npm').reply(200, npmManifest(npm.version))
+ tnock(t, 'https://nodejs.org')
+ .get('/dist/index.json').reply(200, nodeVersions)
+ await npm.exec('doctor', [])
+ t.matchSnapshot(joinedOutput(), 'output')
+ t.notOk(consoleError, 'console.error not called')
+ t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs')
+})
+
+t.test('ping 404', async t => {
+ const { joinedOutput, logs, npm } = await loadMockNpm(t, {
+ mocks,
+ globals,
+ ...dirs,
+ })
+ tnock(t, npm.config.get('registry'))
+ .get('/-/ping?write=true').reply(404, '{}')
+ .get('/npm').reply(200, npmManifest(npm.version))
+ tnock(t, 'https://nodejs.org')
+ .get('/dist/index.json').reply(200, nodeVersions)
+ await t.rejects(npm.exec('doctor', []))
+ t.matchSnapshot(joinedOutput(), 'ping 404')
+ t.ok(consoleError, 'console.error called')
+ t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs')
+})
+
+t.test('ping 404 in color', async t => {
+ const { joinedOutput, logs, npm } = await loadMockNpm(t, {
+ mocks,
+ globals,
+ ...dirs,
+ })
+ tnock(t, npm.config.get('registry'))
+ .get('/-/ping?write=true').reply(404, '{}')
+ .get('/npm').reply(200, npmManifest(npm.version))
+ tnock(t, 'https://nodejs.org')
+ .get('/dist/index.json').reply(200, nodeVersions)
+ npm.config.set('color', 'always')
+ await t.rejects(npm.exec('doctor', []))
+ t.matchSnapshot(joinedOutput(), 'ping 404 in color')
+ t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs')
+})
+
+t.test('ping exception with code', async t => {
+ const { joinedOutput, logs, npm } = await loadMockNpm(t, {
+ mocks,
+ globals,
+ ...dirs,
+ })
+ tnock(t, npm.config.get('registry'))
+ .get('/-/ping?write=true').replyWithError({ message: 'Test Error', code: 'TEST' })
+ .get('/npm').reply(200, npmManifest(npm.version))
+ tnock(t, 'https://nodejs.org')
+ .get('/dist/index.json').reply(200, nodeVersions)
+ await t.rejects(npm.exec('doctor', []))
+ t.matchSnapshot(joinedOutput(), 'ping failure')
+ t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs')
+})
+
+t.test('ping exception without code', async t => {
+ const { joinedOutput, logs, npm } = await loadMockNpm(t, {
+ mocks,
+ globals,
+ ...dirs,
+ })
+ tnock(t, npm.config.get('registry'))
+ .get('/-/ping?write=true').replyWithError({ message: 'Test Error', code: false })
+ .get('/npm').reply(200, npmManifest(npm.version))
+ tnock(t, 'https://nodejs.org')
+ .get('/dist/index.json').reply(200, nodeVersions)
+ await t.rejects(npm.exec('doctor', []))
+ t.matchSnapshot(joinedOutput(), 'ping failure')
+ t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs')
+})
+
+t.test('npm out of date', async t => {
+ const { joinedOutput, logs, npm } = await loadMockNpm(t, {
+ mocks,
+ globals,
+ ...dirs,
+ })
+ tnock(t, npm.config.get('registry'))
+ .get('/-/ping?write=true').reply(200, '{}')
+ .get('/npm').reply(200, npmManifest('2.0.0'))
+ tnock(t, 'https://nodejs.org')
+ .get('/dist/index.json').reply(200, nodeVersions)
+ await t.rejects(npm.exec('doctor', []))
+ t.matchSnapshot(joinedOutput(), 'npm is out of date')
+ t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs')
+})
+
+t.test('node out of date - lts', async t => {
+ const { joinedOutput, logs, npm } = await loadMockNpm(t, {
+ mocks,
+ globals: {
+ ...globals,
+ process: {
+ platform: 'test-not-windows',
+ version: 'v0.0.1',
+ },
},
- level: 'error',
- levels: {
- info: 1,
- error: 0,
+ ...dirs,
+ })
+ tnock(t, npm.config.get('registry'))
+ .get('/-/ping?write=true').reply(200, '{}')
+ .get('/npm').reply(200, npmManifest(npm.version))
+ tnock(t, 'https://nodejs.org')
+ .get('/dist/index.json').reply(200, nodeVersions)
+ await t.rejects(npm.exec('doctor', []))
+ t.matchSnapshot(joinedOutput(), 'node is out of date')
+ t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs')
+})
+
+t.test('node out of date - current', async t => {
+ const { joinedOutput, logs, npm } = await loadMockNpm(t, {
+ mocks,
+ globals: {
+ ...globals,
+ process: {
+ ...globals.process,
+ version: 'v2.0.0',
+ },
},
- },
+ ...dirs,
+ })
+ tnock(t, npm.config.get('registry'))
+ .get('/-/ping?write=true').reply(200, '{}')
+ .get('/npm').reply(200, npmManifest(npm.version))
+ tnock(t, 'https://nodejs.org')
+ .get('/dist/index.json').reply(200, nodeVersions)
+ await t.rejects(npm.exec('doctor', []))
+ t.matchSnapshot(joinedOutput(), 'node is out of date')
+ t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs')
+})
-}
+t.test('non-default registry', async t => {
+ const { joinedOutput, logs, npm } = await loadMockNpm(t, {
+ mocks,
+ globals,
+ config: { registry: 'http://some-other-url.npmjs.org' },
+ ...dirs,
+ })
+ tnock(t, npm.config.get('registry'))
+ .get('/-/ping?write=true').reply(200, '{}')
+ .get('/npm').reply(200, npmManifest(npm.version))
+ tnock(t, 'https://nodejs.org')
+ .get('/dist/index.json').reply(200, nodeVersions)
+ await t.rejects(npm.exec('doctor', []))
+ t.matchSnapshot(joinedOutput(), 'non default registry')
+ t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs')
+})
-const Doctor = t.mock('../../../lib/commands/doctor.js', {
- ...mocks,
+t.test('missing git', async t => {
+ const { joinedOutput, logs, npm } = await loadMockNpm(t, {
+ mocks: {
+ ...mocks,
+ which: async () => {
+ throw new Error('test error')
+ },
+ },
+ globals,
+ ...dirs,
+ })
+ tnock(t, npm.config.get('registry'))
+ .get('/-/ping?write=true').reply(200, '{}')
+ .get('/npm').reply(200, npmManifest(npm.version))
+ tnock(t, 'https://nodejs.org')
+ .get('/dist/index.json').reply(200, nodeVersions)
+ await t.rejects(npm.exec('doctor', []))
+ t.matchSnapshot(joinedOutput(), 'missing git')
+ t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs')
})
-const doctor = new Doctor(npm)
-
-const origVersion = process.version
-t.test('node versions', t => {
- t.plan(nodeVersions.length)
-
- nodeVersions.forEach(({ version }) => {
- t.test(`${version}:`, vt => {
- Object.defineProperty(process, 'version', { value: version })
- vt.teardown(() => {
- Object.defineProperty(process, 'version', { value: origVersion })
- })
-
- vt.test(`${version}: npm doctor checks ok`, async st => {
- const dir = st.testdir()
- npm.cache = npm.flatOptions.cache = dir
- npm.localDir = dir
- npm.globalDir = dir
- npm.localBin = dir
- npm.globalBin = dir
-
- st.teardown(() => {
- delete npm.cache
- delete npm.flatOptions.cache
- delete npm.localDir
- delete npm.globalDir
- delete npm.localBin
- delete npm.globalBin
- clearLogs()
- })
-
- await doctor.exec([])
- st.match(
- logs,
- {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [dir]: { finished: true },
- verifyCachedFiles: { finished: true },
- },
- 'trackers all finished'
- )
- st.match(output, /npm ping\s*ok/, 'ping output is ok')
- st.match(output, /npm -v\s*ok/, 'npm -v output is ok')
- st.match(output, /node -v\s*ok/, 'node -v output is ok')
- st.match(
- output,
- /npm config get registry\s*ok\s*using default/,
- 'npm config get registry output is ok'
- )
- st.match(output, /which git\s*ok/, 'which git output is ok')
- st.match(output, /cached files\s*ok/, 'cached files are ok')
- st.match(output, /local node_modules\s*ok/, 'local node_modules are ok')
- st.match(output, /global node_modules\s*ok/, 'global node_modules are ok')
- st.match(output, /local bin folder\s*ok/, 'local bin is ok')
- st.match(output, /global bin folder\s*ok/, 'global bin is ok')
- st.match(output, /cache contents\s*ok/, 'cache contents is ok')
- })
-
- vt.test('npm doctor supports silent', async st => {
- const dir = st.testdir()
- npm.cache = npm.flatOptions.cache = dir
- npm.localDir = dir
- npm.globalDir = dir
- npm.localBin = dir
- npm.globalBin = dir
- npm.config.set('loglevel', 'silent')
-
- st.teardown(() => {
- delete npm.cache
- delete npm.flatOptions.cache
- delete npm.localDir
- delete npm.globalDir
- delete npm.localBin
- delete npm.globalBin
- npm.config.set('loglevel', 'info')
- clearLogs()
- })
-
- await doctor.exec([])
-
- st.match(
- logs,
- {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [dir]: { finished: true },
- verifyCachedFiles: { finished: true },
- },
- 'trackers all finished'
- )
- st.strictSame(output, [], 'did not print output')
- })
-
- vt.test('npm doctor supports color', async st => {
- const dir = st.testdir()
- npm.cache = npm.flatOptions.cache = dir
- npm.localDir = dir
- npm.globalDir = dir
- npm.localBin = dir
- npm.globalBin = dir
- npm.color = true
- pingError = { message: 'generic error' }
- const _consoleError = console.error
- console.error = () => {}
-
- st.teardown(() => {
- delete npm.cache
- delete npm.flatOptions.cache
- delete npm.localDir
- delete npm.globalDir
- delete npm.localBin
- delete npm.globalBin
- delete npm.color
- pingError = null
- console.error = _consoleError
- clearLogs()
- })
-
- await st.rejects(doctor.exec([]), /Some problems found/, 'detected the ping error')
- st.match(
- logs,
- {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [dir]: { finished: true },
- verifyCachedFiles: { finished: true },
- },
- 'trackers all finished'
- )
- st.match(output, /npm ping.*not ok/, 'ping output is ok')
- st.match(output, /npm -v.*ok/, 'npm -v output is ok')
- st.match(output, /node -v.*ok/, 'node -v output is ok')
- st.match(
- output,
- /npm config get registry.*ok.*using default/,
- 'npm config get registry output is ok'
- )
- st.match(output, /which git.*ok/, 'which git output is ok')
- st.match(output, /cached files.*ok/, 'cached files are ok')
- st.match(output, /local node_modules.*ok/, 'local node_modules are ok')
- st.match(output, /global node_modules.*ok/, 'global node_modules are ok')
- st.match(output, /local bin folder.*ok/, 'local bin is ok')
- st.match(output, /global bin folder.*ok/, 'global bin is ok')
- st.match(output, /cache contents.*ok/, 'cache contents is ok')
- st.not(output[0], ansiTrim(output[0]), 'output should contain color codes')
- })
-
- vt.test('npm doctor skips some tests in windows', async st => {
- const WinDoctor = t.mock('../../../lib/commands/doctor.js', {
- ...mocks,
- '../../../lib/utils/is-windows.js': true,
- })
- const winDoctor = new WinDoctor(npm)
-
- const dir = st.testdir()
- npm.cache = npm.flatOptions.cache = dir
- npm.localDir = dir
- npm.globalDir = dir
- npm.localBin = dir
- npm.globalBin = dir
-
- st.teardown(() => {
- delete npm.cache
- delete npm.flatOptions.cache
- delete npm.localDir
- delete npm.globalDir
- delete npm.localBin
- delete npm.globalBin
- clearLogs()
- })
-
- await winDoctor.exec([])
- st.match(
- logs,
- {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [dir]: undefined,
- verifyCachedFiles: { finished: true },
- },
- 'trackers all finished'
- )
- st.match(output, /npm ping\s*ok/, 'ping output is ok')
- st.match(output, /npm -v\s*ok/, 'npm -v output is ok')
- st.match(output, /node -v\s*ok/, 'node -v output is ok')
- st.match(
- output,
- /npm config get registry\s*ok\s*using default/,
- 'npm config get registry output is ok'
- )
- st.match(output, /which git\s*ok/, 'which git output is ok')
- st.match(output, /cache contents\s*ok/, 'cache contents is ok')
- })
-
- vt.test('npm doctor ping error E{3}', async st => {
- const dir = st.testdir()
- npm.cache = npm.flatOptions.cache = dir
- npm.localDir = dir
- npm.globalDir = dir
- npm.localBin = dir
- npm.globalBin = dir
- pingError = { code: 'E111', message: 'this error is 111' }
- const consoleError = console.error
- // we just print an empty line here, so swallow it and ignore
- console.error = () => {}
-
- st.teardown(() => {
- delete npm.cache
- delete npm.flatOptions.cache
- delete npm.localDir
- delete npm.globalDir
- delete npm.localBin
- delete npm.globalBin
- pingError = null
- console.error = consoleError
- clearLogs()
- })
-
- await st.rejects(doctor.exec([]), /Some problems found/, 'detected the ping error')
- st.match(
- logs,
- {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [dir]: { finished: true },
- verifyCachedFiles: { finished: true },
- },
- 'trackers all finished'
- )
- st.match(
- output,
- /npm ping\s*not ok\s*111 this error is 111/,
- 'ping output contains trimmed error'
- )
- st.match(output, /npm -v\s*ok/, 'npm -v output is ok')
- st.match(output, /node -v\s*ok/, 'node -v output is ok')
- st.match(
- output,
- /npm config get registry\s*ok\s*using default/,
- 'npm config get registry output is ok'
- )
- st.match(output, /which git\s*ok/, 'which git output is ok')
- st.match(output, /cached files\s*ok/, 'cached files are ok')
- st.match(output, /local node_modules\s*ok/, 'local node_modules are ok')
- st.match(output, /global node_modules\s*ok/, 'global node_modules are ok')
- st.match(output, /local bin folder\s*ok/, 'local bin is ok')
- st.match(output, /global bin folder\s*ok/, 'global bin is ok')
- st.match(output, /cache contents\s*ok/, 'cache contents is ok')
- })
-
- vt.test('npm doctor generic ping error', async st => {
- const dir = st.testdir()
- npm.cache = npm.flatOptions.cache = dir
- npm.localDir = dir
- npm.globalDir = dir
- npm.localBin = dir
- npm.globalBin = dir
- pingError = { message: 'generic error' }
- const consoleError = console.error
- // we just print an empty line here, so swallow it and ignore
- console.error = () => {}
-
- st.teardown(() => {
- delete npm.cache
- delete npm.flatOptions.cache
- delete npm.localDir
- delete npm.globalDir
- delete npm.localBin
- delete npm.globalBin
- pingError = null
- console.error = consoleError
- clearLogs()
- })
-
- await st.rejects(doctor.exec([]), /Some problems found/, 'detected the ping error')
- st.match(
- logs,
- {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [dir]: { finished: true },
- verifyCachedFiles: { finished: true },
- },
- 'trackers all finished'
- )
- st.match(output, /npm ping\s*not ok\s*generic error/, 'ping output contains trimmed error')
- st.match(output, /npm -v\s*ok/, 'npm -v output is ok')
- st.match(output, /node -v\s*ok/, 'node -v output is ok')
- st.match(
- output,
- /npm config get registry\s*ok\s*using default/,
- 'npm config get registry output is ok'
- )
- st.match(output, /which git\s*ok/, 'which git output is ok')
- st.match(output, /cached files\s*ok/, 'cached files are ok')
- st.match(output, /local node_modules\s*ok/, 'local node_modules are ok')
- st.match(output, /global node_modules\s*ok/, 'global node_modules are ok')
- st.match(output, /local bin folder\s*ok/, 'local bin is ok')
- st.match(output, /global bin folder\s*ok/, 'global bin is ok')
- st.match(output, /cache contents\s*ok/, 'cache contents is ok')
- })
-
- vt.test('npm doctor outdated npm version', async st => {
- const dir = st.testdir()
- npm.cache = npm.flatOptions.cache = dir
- npm.localDir = dir
- npm.globalDir = dir
- npm.localBin = dir
- npm.globalBin = dir
- latestNpm = '7.1.1'
- const consoleError = console.error
- // we just print an empty line here, so swallow it and ignore
- console.error = () => {}
-
- st.teardown(() => {
- delete npm.cache
- delete npm.flatOptions.cache
- delete npm.localDir
- delete npm.globalDir
- delete npm.localBin
- delete npm.globalBin
- latestNpm = npm.version
- console.error = consoleError
- clearLogs()
- })
-
- await st.rejects(doctor.exec([]), /Some problems found/, 'detected the out of date npm')
- st.match(
- logs,
- {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [dir]: { finished: true },
- verifyCachedFiles: { finished: true },
- },
- 'trackers all finished'
- )
- st.match(output, /npm ping\s*ok/, 'ping output is ok')
- st.match(output, /npm -v\s*not ok/, 'npm -v output is not ok')
- st.match(output, /node -v\s*ok/, 'node -v output is ok')
- st.match(
- output,
- /npm config get registry\s*ok\s*using default/,
- 'npm config get registry output is ok'
- )
- st.match(output, /which git\s*ok/, 'which git output is ok')
- st.match(output, /cached files\s*ok/, 'cached files are ok')
- st.match(output, /local node_modules\s*ok/, 'local node_modules are ok')
- st.match(output, /global node_modules\s*ok/, 'global node_modules are ok')
- st.match(output, /local bin folder\s*ok/, 'local bin is ok')
- st.match(output, /global bin folder\s*ok/, 'global bin is ok')
- st.match(output, /cache contents\s*ok/, 'cache contents is ok')
- })
-
- vt.test('npm doctor file permission checks', async st => {
- const dir = st.testdir({
- cache: {
- one: 'one',
- link: st.fixture('symlink', './baddir'),
- unreadable: 'unreadable',
- baddir: {},
- },
- local: {
- two: 'two',
- notmine: 'notmine',
- },
- global: {
- three: 'three',
- broken: 'broken',
- },
- localBin: {
- four: 'four',
- five: 'five',
- },
- globalBin: {
- six: 'six',
- seven: 'seven',
- },
- })
-
- const _fsLstat = fs.lstat
- fs.lstat = (p, cb) => {
- let err = null
- let stat = null
-
- try {
- stat = fs.lstatSync(p)
- } catch (err) {
- return cb(err)
- }
-
- switch (p) {
- case join(dir, 'local', 'notmine'):
- stat.uid += 1
- stat.gid += 1
- break
- case join(dir, 'global', 'broken'):
- err = new Error('broken')
- break
- }
-
- return cb(err, stat)
- }
-
- const _fsReaddir = fs.readdir
- fs.readdir = (p, cb) => {
- let err = null
- let result = null
-
- try {
- result = fs.readdirSync(p)
- } catch (err) {
- return cb(err)
- }
-
- if (p === join(dir, 'cache', 'baddir')) {
- err = new Error('broken')
- }
-
- return cb(err, result)
- }
-
- const _fsAccess = fs.access
- fs.access = (p, mask, cb) => {
- const err = new Error('failed')
- switch (p) {
- case join(dir, 'cache', 'unreadable'):
- case join(dir, 'localBin', 'four'):
- case join(dir, 'globalBin', 'six'):
- return cb(err)
- default:
- return cb(null)
- }
- }
-
- const Doctor = t.mock('../../../lib/commands/doctor.js', {
- ...mocks,
- fs,
- })
- const doctor = new Doctor(npm)
- // it's necessary to allow tests in node 10.x to not mark 12.x as lted
-
- npm.cache = npm.flatOptions.cache = join(dir, 'cache')
- npm.localDir = join(dir, 'local')
- npm.globalDir = join(dir, 'global')
- npm.localBin = join(dir, 'localBin')
- npm.globalBin = join(dir, 'globalBin')
- const _consoleError = console.error
- console.error = () => {}
-
- st.teardown(() => {
- delete npm.cache
- delete npm.flatOptions.cache
- delete npm.localDir
- delete npm.globalDir
- delete npm.localBin
- delete npm.globalBin
- console.error = _consoleError
- fs.lstat = _fsLstat
- fs.readdir = _fsReaddir
- fs.access = _fsAccess
- clearLogs()
- })
-
- await st.rejects(doctor.exec([]), /Some problems found/, 'identified problems')
- st.match(
- logs,
- {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [join(dir, 'cache')]: { finished: true },
- [join(dir, 'local')]: { finished: true },
- [join(dir, 'global')]: { finished: true },
- [join(dir, 'localBin')]: { finished: true },
- [join(dir, 'globalBin')]: { finished: true },
- verifyCachedFiles: { finished: true },
- },
- 'trackers all finished'
- )
- st.match(output, /npm ping\s*ok/, 'ping output is ok')
- st.match(output, /npm -v\s*ok/, 'npm -v output is ok')
- st.match(output, /node -v\s*ok/, 'node -v output is ok')
- st.match(
- output,
- /npm config get registry\s*ok\s*using default/,
- 'npm config get registry output is ok'
- )
- st.match(output, /which git\s*ok/, 'which git output is ok')
- st.match(output, /cached files\s*not ok/, 'cached files are not ok')
- st.match(output, /local node_modules\s*not ok/, 'local node_modules are not ok')
- st.match(output, /global node_modules\s*not ok/, 'global node_modules are not ok')
- st.match(output, /local bin folder\s*not ok/, 'local bin is not ok')
- st.match(output, /global bin folder\s*not ok/, 'global bin is not ok')
- st.match(output, /cache contents\s*ok/, 'cache contents is ok')
- })
-
- vt.test('npm doctor missing git', async st => {
- const dir = st.testdir()
- npm.cache = npm.flatOptions.cache = dir
- npm.localDir = dir
- npm.globalDir = dir
- npm.localBin = dir
- npm.globalBin = dir
- whichError = new Error('boom')
- const consoleError = console.error
- // we just print an empty line here, so swallow it and ignore
- console.error = () => {}
-
- st.teardown(() => {
- delete npm.cache
- delete npm.flatOptions.cache
- delete npm.localDir
- delete npm.globalDir
- delete npm.localBin
- delete npm.globalBin
- whichError = null
- console.error = consoleError
- clearLogs()
- })
-
- await st.rejects(doctor.exec([]), /Some problems found/, 'detected the missing git')
- st.match(
- logs,
- {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [dir]: { finished: true },
- verifyCachedFiles: { finished: true },
- },
- 'trackers all finished'
- )
- st.match(output, /npm ping\s*ok/, 'ping output is ok')
- st.match(output, /npm -v\s*ok/, 'npm -v output is ok')
- st.match(output, /node -v\s*ok/, 'node -v output is ok')
- st.match(
- output,
- /npm config get registry\s*ok\s*using default/,
- 'npm config get registry output is ok'
- )
- st.match(output, /which git\s*not ok/, 'which git output is not ok')
- st.match(output, /cached files\s*ok/, 'cached files are ok')
- st.match(output, /local node_modules\s*ok/, 'local node_modules are ok')
- st.match(output, /global node_modules\s*ok/, 'global node_modules are ok')
- st.match(output, /local bin folder\s*ok/, 'local bin is ok')
- st.match(output, /global bin folder\s*ok/, 'global bin is ok')
- st.match(output, /cache contents\s*ok/, 'cache contents is ok')
- })
-
- vt.test('npm doctor cache verification showed bad content', async st => {
- const dir = st.testdir()
- npm.cache = npm.flatOptions.cache = dir
- npm.localDir = dir
- npm.globalDir = dir
- npm.localBin = dir
- npm.globalBin = dir
- const _verifyResponse = verifyResponse
- verifyResponse = {
- ...verifyResponse,
- badContentCount: 1,
- }
- const consoleError = console.error
- // we just print an empty line here, so swallow it and ignore
- console.error = () => {}
-
- st.teardown(() => {
- delete npm.cache
- delete npm.flatOptions.cache
- delete npm.localDir
- delete npm.globalDir
- delete npm.localBin
- delete npm.globalBin
- verifyResponse = _verifyResponse
- console.error = consoleError
- clearLogs()
- })
-
- // cache verification problems get fixed and so do not throw an error
- await doctor.exec([])
- st.match(
- logs,
- {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [dir]: { finished: true },
- verifyCachedFiles: { finished: true },
- },
- 'trackers all finished'
- )
- st.match(output, /npm ping\s*ok/, 'ping output is ok')
- st.match(output, /npm -v\s*ok/, 'npm -v output is ok')
- st.match(output, /node -v\s*ok/, 'node -v output is ok')
- st.match(
- output,
- /npm config get registry\s*ok\s*using default/,
- 'npm config get registry output is ok'
- )
- st.match(output, /which git\s*ok/, 'which git output is ok')
- st.match(output, /cached files\s*ok/, 'cached files are ok')
- st.match(output, /local node_modules\s*ok/, 'local node_modules are ok')
- st.match(output, /global node_modules\s*ok/, 'global node_modules are ok')
- st.match(output, /local bin folder\s*ok/, 'local bin is ok')
- st.match(output, /global bin folder\s*ok/, 'global bin is ok')
- st.match(output, /cache contents\s*ok/, 'cache contents is not ok')
- })
-
- vt.test('npm doctor cache verification showed reclaimed content', async st => {
- const dir = st.testdir()
- npm.cache = npm.flatOptions.cache = dir
- npm.localDir = dir
- npm.globalDir = dir
- npm.localBin = dir
- npm.globalBin = dir
- const _verifyResponse = verifyResponse
- verifyResponse = {
- ...verifyResponse,
- reclaimedCount: 1,
- reclaimedSize: 100,
- }
- const consoleError = console.error
- // we just print an empty line here, so swallow it and ignore
- console.error = () => {}
-
- st.teardown(() => {
- delete npm.cache
- delete npm.flatOptions.cache
- delete npm.localDir
- delete npm.globalDir
- delete npm.localBin
- delete npm.globalBin
- verifyResponse = _verifyResponse
- console.error = consoleError
- clearLogs()
- })
-
- // cache verification problems get fixed and so do not throw an error
- await doctor.exec([])
-
- st.match(
- logs,
- {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [dir]: { finished: true },
- verifyCachedFiles: { finished: true },
- },
- 'trackers all finished'
- )
- st.match(output, /npm ping\s*ok/, 'ping output is ok')
- st.match(output, /npm -v\s*ok/, 'npm -v output is ok')
- st.match(output, /node -v\s*ok/, 'node -v output is ok')
- st.match(
- output,
- /npm config get registry\s*ok\s*using default/,
- 'npm config get registry output is ok'
- )
- st.match(output, /which git\s*ok/, 'which git output is ok')
- st.match(output, /cached files\s*ok/, 'cached files are ok')
- st.match(output, /local node_modules\s*ok/, 'local node_modules are ok')
- st.match(output, /global node_modules\s*ok/, 'global node_modules are ok')
- st.match(output, /local bin folder\s*ok/, 'local bin is ok')
- st.match(output, /global bin folder\s*ok/, 'global bin is ok')
- st.match(output, /cache contents\s*ok/, 'cache contents is not ok')
- })
-
- vt.test('npm doctor cache verification showed missing content', async st => {
- const dir = t.testdir()
- npm.cache = npm.flatOptions.cache = dir
- npm.localDir = dir
- npm.globalDir = dir
- npm.localBin = dir
- npm.globalBin = dir
- const _verifyResponse = verifyResponse
- verifyResponse = {
- ...verifyResponse,
- missingContent: 1,
- }
- const consoleError = console.error
- // we just print an empty line here, so swallow it and ignore
- console.error = () => {}
-
- st.teardown(() => {
- delete npm.cache
- delete npm.flatOptions.cache
- delete npm.localDir
- delete npm.globalDir
- delete npm.localBin
- delete npm.globalBin
- verifyResponse = _verifyResponse
- console.error = consoleError
- clearLogs()
- })
-
- // cache verification problems get fixed and so do not throw an error
- await doctor.exec([])
- st.match(
- logs,
- {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [dir]: { finished: true },
- verifyCachedFiles: { finished: true },
- },
- 'trackers all finished'
- )
- st.match(output, /npm ping\s*ok/, 'ping output is ok')
- st.match(output, /npm -v\s*ok/, 'npm -v output is ok')
- st.match(output, /node -v\s*ok/, 'node -v output is ok')
- st.match(
- output,
- /npm config get registry\s*ok\s*using default/,
- 'npm config get registry output is ok'
- )
- st.match(output, /which git\s*ok/, 'which git output is ok')
- st.match(output, /cached files\s*ok/, 'cached files are ok')
- st.match(output, /local node_modules\s*ok/, 'local node_modules are ok')
- st.match(output, /global node_modules\s*ok/, 'global node_modules are ok')
- st.match(output, /local bin folder\s*ok/, 'local bin is ok')
- st.match(output, /global bin folder\s*ok/, 'global bin is ok')
- st.match(output, /cache contents\s*ok/, 'cache contents is not ok')
- })
-
- vt.test('npm doctor not using default registry', async st => {
- const dir = st.testdir()
- npm.cache = npm.flatOptions.cache = dir
- npm.localDir = dir
- npm.globalDir = dir
- npm.localBin = dir
- npm.globalBin = dir
- const _currentRegistry = npm.flatOptions.registry
- npm.flatOptions.registry = 'https://google.com'
- const consoleError = console.error
- // we just print an empty line here, so swallow it and ignore
- console.error = () => {}
-
- st.teardown(() => {
- delete npm.cache
- delete npm.flatOptions.cache
- delete npm.localDir
- delete npm.globalDir
- delete npm.localBin
- delete npm.globalBin
- npm.flatOptions.registry = _currentRegistry
- console.error = consoleError
- clearLogs()
- })
-
- await st.rejects(
- doctor.exec([]),
- /Some problems found/,
- 'detected the non-default registry'
- )
- st.match(
- logs,
- {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [dir]: { finished: true },
- verifyCachedFiles: { finished: true },
- },
- 'trackers all finished'
- )
- st.match(output, /npm ping\s*ok/, 'ping output is ok')
- st.match(output, /npm -v\s*ok/, 'npm -v output is ok')
- st.match(output, /node -v\s*ok/, 'node -v output is ok')
- st.match(
- output,
- /npm config get registry\s*not ok/,
- 'npm config get registry output is not ok'
- )
- st.match(output, /which git\s*ok/, 'which git output is ok')
- st.match(output, /cached files\s*ok/, 'cached files are ok')
- st.match(output, /local node_modules\s*ok/, 'local node_modules are ok')
- st.match(output, /global node_modules\s*ok/, 'global node_modules are ok')
- st.match(output, /local bin folder\s*ok/, 'local bin is ok')
- st.match(output, /global bin folder\s*ok/, 'global bin is ok')
- st.match(output, /cache contents\s*ok/, 'cache contents is ok')
- })
-
- vt.end()
- })
+
+t.test('windows skips permissions checks', async t => {
+ const { joinedOutput, logs, npm } = await loadMockNpm(t, {
+ mocks,
+ globals: {
+ ...globals,
+ process: {
+ ...globals.process,
+ platform: 'win32',
+ },
+ },
+ prefixDir: {},
+ globalPrefixDir: {},
})
+ tnock(t, npm.config.get('registry'))
+ .get('/-/ping?write=true').reply(200, '{}')
+ .get('/npm').reply(200, npmManifest(npm.version))
+ tnock(t, 'https://nodejs.org')
+ .get('/dist/index.json').reply(200, nodeVersions)
+ await npm.exec('doctor', [])
+ t.matchSnapshot(joinedOutput(), 'no permissions checks')
+ t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs')
})
-t.test('outdated node version', vt => {
- vt.plan(1)
- const version = 'v10.0.0'
+t.test('missing global directories', async t => {
+ const { joinedOutput, logs, npm } = await loadMockNpm(t, {
+ mocks,
+ globals,
+ prefixDir: dirs.prefixDir,
+ })
+ tnock(t, npm.config.get('registry'))
+ .get('/-/ping?write=true').reply(200, '{}')
+ .get('/npm').reply(200, npmManifest(npm.version))
+ tnock(t, 'https://nodejs.org')
+ .get('/dist/index.json').reply(200, nodeVersions)
+ await t.rejects(npm.exec('doctor', []))
+ t.matchSnapshot(joinedOutput(), 'missing global directories')
+ t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs')
+})
- Object.defineProperty(process, 'version', { value: version })
- vt.teardown(() => {
- Object.defineProperty(process, 'version', { value: origVersion })
+t.test('missing local node_modules', async t => {
+ const { joinedOutput, logs, npm } = await loadMockNpm(t, {
+ mocks,
+ globals,
+ globalPrefixDir: dirs.globalPrefixDir,
})
+ tnock(t, npm.config.get('registry'))
+ .get('/-/ping?write=true').reply(200, '{}')
+ .get('/npm').reply(200, npmManifest(npm.version))
+ tnock(t, 'https://nodejs.org')
+ .get('/dist/index.json').reply(200, nodeVersions)
+ await npm.exec('doctor', [])
+ t.matchSnapshot(joinedOutput(), 'missing local node_modules')
+ t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs')
+})
- vt.test('npm doctor outdated nodejs version', async st => {
- const dir = st.testdir()
- npm.cache = npm.flatOptions.cache = dir
- npm.localDir = dir
- npm.globalDir = dir
- npm.localBin = dir
- npm.globalBin = dir
- nodeVersions.push({ version: process.version.replace(/\d+(-.*)?$/, '999'), lts: false })
- const consoleError = console.error
- // we just print an empty line here, so swallow it and ignore
- console.error = () => {}
-
- st.teardown(() => {
- delete npm.cache
- delete npm.flatOptions.cache
- delete npm.localDir
- delete npm.globalDir
- delete npm.localBin
- delete npm.globalBin
- nodeVersions.pop()
- console.error = consoleError
- clearLogs()
- })
-
- await st.rejects(doctor.exec([]), /Some problems found/, 'detected the out of date nodejs')
- st.match(
- logs,
- {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [dir]: { finished: true },
- verifyCachedFiles: { finished: true },
+t.test('incorrect owner', async t => {
+ const { joinedOutput, logs, npm } = await loadMockNpm(t, {
+ mocks: {
+ ...mocks,
+ fs: {
+ ...fs,
+ lstat: (p, cb) => {
+ const stat = fs.lstatSync(p)
+ stat.uid += 1
+ stat.gid += 1
+ return cb(null, stat)
+ },
},
- 'trackers all finished'
- )
- st.match(output, /npm ping\s*ok/, 'ping output is ok')
- st.match(output, /npm -v\s*ok/, 'npm -v output is ok')
- st.match(output, /node -v\s*not ok/, 'node -v output is not ok')
- st.match(
- output,
- /npm config get registry\s*ok\s*using default/,
- 'npm config get registry output is ok'
- )
- st.match(output, /which git\s*ok/, 'which git output is ok')
- st.match(output, /cached files\s*ok/, 'cached files are ok')
- st.match(output, /local node_modules\s*ok/, 'local node_modules are ok')
- st.match(output, /global node_modules\s*ok/, 'global node_modules are ok')
- st.match(output, /local bin folder\s*ok/, 'local bin is ok')
- st.match(output, /global bin folder\s*ok/, 'global bin is ok')
- st.match(output, /cache contents\s*ok/, 'cache contents is ok')
+ },
+ globals,
+ ...dirs,
+ })
+ tnock(t, npm.config.get('registry'))
+ .get('/-/ping?write=true').reply(200, '{}')
+ .get('/npm').reply(200, npmManifest(npm.version))
+ tnock(t, 'https://nodejs.org')
+ .get('/dist/index.json').reply(200, nodeVersions)
+ await t.rejects(npm.exec('doctor', []))
+ t.matchSnapshot(joinedOutput(), 'incorrect owner')
+ t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs')
+})
+
+t.test('incorrect permissions', async t => {
+ const { joinedOutput, logs, npm } = await loadMockNpm(t, {
+ mocks: {
+ ...mocks,
+ fs: {
+ ...fs,
+ access: () => {
+ throw new Error('Test Error')
+ },
+ },
+ },
+ globals,
+ ...dirs,
+ })
+ tnock(t, npm.config.get('registry'))
+ .get('/-/ping?write=true').reply(200, '{}')
+ .get('/npm').reply(200, npmManifest(npm.version))
+ tnock(t, 'https://nodejs.org')
+ .get('/dist/index.json').reply(200, nodeVersions)
+ await t.rejects(npm.exec('doctor', []))
+ t.matchSnapshot(joinedOutput(), 'incorrect owner')
+ t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs')
+})
+
+t.test('error reading directory', async t => {
+ const { joinedOutput, logs, npm } = await loadMockNpm(t, {
+ mocks: {
+ ...mocks,
+ fs: {
+ ...fs,
+ readdir: () => {
+ throw new Error('Test Error')
+ },
+ },
+ },
+ globals,
+ ...dirs,
+ })
+ tnock(t, npm.config.get('registry'))
+ .get('/-/ping?write=true').reply(200, '{}')
+ .get('/npm').reply(200, npmManifest(npm.version))
+ tnock(t, 'https://nodejs.org')
+ .get('/dist/index.json').reply(200, nodeVersions)
+ await t.rejects(npm.exec('doctor', []))
+ t.matchSnapshot(joinedOutput(), 'readdir error')
+ t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs')
+})
+
+t.test('cacache badContent', async t => {
+ const { joinedOutput, logs, npm } = await loadMockNpm(t, {
+ mocks: {
+ ...mocks,
+ cacache: {
+ verify: async () => {
+ return { badContentCount: 1, reclaimedCount: 0, missingContent: 0, verifiedContent: 2 }
+ },
+ },
+ },
+ globals,
+ ...dirs,
+ })
+ tnock(t, npm.config.get('registry'))
+ .get('/-/ping?write=true').reply(200, '{}')
+ .get('/npm').reply(200, npmManifest(npm.version))
+ tnock(t, 'https://nodejs.org')
+ .get('/dist/index.json').reply(200, nodeVersions)
+ await npm.exec('doctor', [])
+ t.matchSnapshot(joinedOutput(), 'corrupted cache content')
+ t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs')
+})
+
+t.test('cacache reclaimedCount', async t => {
+ const { joinedOutput, logs, npm } = await loadMockNpm(t, {
+ mocks: {
+ ...mocks,
+ cacache: {
+ verify: async () => {
+ return { badContentCount: 0, reclaimedCount: 1, missingContent: 0, verifiedContent: 2 }
+ },
+ },
+ },
+ globals,
+ ...dirs,
+ })
+ tnock(t, npm.config.get('registry'))
+ .get('/-/ping?write=true').reply(200, '{}')
+ .get('/npm').reply(200, npmManifest(npm.version))
+ tnock(t, 'https://nodejs.org')
+ .get('/dist/index.json').reply(200, nodeVersions)
+ await npm.exec('doctor', [])
+ t.matchSnapshot(joinedOutput(), 'content garbage collected')
+ t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs')
+})
+
+t.test('cacache missingContent', async t => {
+ const { joinedOutput, logs, npm } = await loadMockNpm(t, {
+ mocks: {
+ ...mocks,
+ cacache: {
+ verify: async () => {
+ return { badContentCount: 0, reclaimedCount: 0, missingContent: 1, verifiedContent: 2 }
+ },
+ },
+ },
+ globals,
+ ...dirs,
+ })
+ tnock(t, npm.config.get('registry'))
+ .get('/-/ping?write=true').reply(200, '{}')
+ .get('/npm').reply(200, npmManifest(npm.version))
+ tnock(t, 'https://nodejs.org')
+ .get('/dist/index.json').reply(200, nodeVersions)
+ await npm.exec('doctor', [])
+ t.matchSnapshot(joinedOutput(), 'missing content')
+ t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs')
+})
+
+t.test('bad proxy', async t => {
+ const { joinedOutput, logs, npm } = await loadMockNpm(t, {
+ mocks,
+ globals,
+ config: {
+ proxy: 'ssh://npmjs.org',
+ },
+ ...dirs,
})
+ await t.rejects(npm.exec('doctor', []))
+ t.matchSnapshot(joinedOutput(), 'output')
+ t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs')
})
diff --git a/deps/npm/test/lib/commands/pack.js b/deps/npm/test/lib/commands/pack.js
index 51453dae9b017d..f287d93dc75365 100644
--- a/deps/npm/test/lib/commands/pack.js
+++ b/deps/npm/test/lib/commands/pack.js
@@ -10,7 +10,7 @@ t.afterEach(t => {
t.test('should pack current directory with no arguments', async t => {
const { npm, outputs, logs } = await loadMockNpm(t, {
- testdir: {
+ prefixDir: {
'package.json': JSON.stringify({
name: 'test-package',
version: '1.0.0',
@@ -27,7 +27,7 @@ t.test('should pack current directory with no arguments', async t => {
t.test('follows pack-destination config', async t => {
const { npm, outputs } = await loadMockNpm(t, {
- testdir: {
+ prefixDir: {
'package.json': JSON.stringify({
name: 'test-package',
version: '1.0.0',
@@ -45,7 +45,7 @@ t.test('follows pack-destination config', async t => {
t.test('should pack given directory for scoped package', async t => {
const { npm, outputs } = await loadMockNpm(t, {
- testdir: {
+ prefixDir: {
'package.json': JSON.stringify({
name: '@npm/test-package',
version: '1.0.0',
@@ -61,7 +61,7 @@ t.test('should pack given directory for scoped package', async t => {
t.test('should log output as valid json', async t => {
const { npm, outputs, logs } = await loadMockNpm(t, {
- testdir: {
+ prefixDir: {
'package.json': JSON.stringify({
name: 'test-package',
version: '1.0.0',
@@ -79,7 +79,7 @@ t.test('should log output as valid json', async t => {
t.test('dry run', async t => {
const { npm, outputs, logs } = await loadMockNpm(t, {
- testdir: {
+ prefixDir: {
'package.json': JSON.stringify({
name: 'test-package',
version: '1.0.0',
@@ -97,7 +97,7 @@ t.test('dry run', async t => {
t.test('invalid packument', async t => {
const { npm, outputs } = await loadMockNpm(t, {
- testdir: {
+ prefixDir: {
'package.json': '{}',
},
})
@@ -111,7 +111,7 @@ t.test('invalid packument', async t => {
t.test('workspaces', async t => {
const loadWorkspaces = (t) => loadMockNpm(t, {
- testdir: {
+ prefixDir: {
'package.json': JSON.stringify(
{
name: 'workspaces-test',
diff --git a/deps/npm/test/lib/commands/repo.js b/deps/npm/test/lib/commands/repo.js
index 93eb6d0311e1cf..e06a2894417bc2 100644
--- a/deps/npm/test/lib/commands/repo.js
+++ b/deps/npm/test/lib/commands/repo.js
@@ -188,10 +188,10 @@ const openUrl = async (npm, url, errMsg) => {
}
t.afterEach(() => opened = {})
-const loadMockNpm = async (t, prefix) => {
+const loadMockNpm = async (t, prefixDir) => {
const res = await _loadMockNpm(t, {
mocks: { '../../lib/utils/open-url.js': openUrl },
- testdir: prefix,
+ prefixDir,
})
return res
}
diff --git a/deps/npm/test/lib/commands/restart.js b/deps/npm/test/lib/commands/restart.js
index 7730f1a3011f69..83773eae9543b3 100644
--- a/deps/npm/test/lib/commands/restart.js
+++ b/deps/npm/test/lib/commands/restart.js
@@ -14,7 +14,7 @@ const makeSpawnArgs = require('@npmcli/run-script/lib/make-spawn-args.js')
t.test('should run restart script from package.json', async t => {
const { npm } = await loadMockNpm(t, {
- testdir: {
+ prefixDir: {
'package.json': JSON.stringify({
name: 'x',
version: '1.2.3',
diff --git a/deps/npm/test/lib/commands/shrinkwrap.js b/deps/npm/test/lib/commands/shrinkwrap.js
index 2b9e46c70c98e0..e3fc1f9356705e 100644
--- a/deps/npm/test/lib/commands/shrinkwrap.js
+++ b/deps/npm/test/lib/commands/shrinkwrap.js
@@ -19,14 +19,14 @@ t.formatSnapshot = obj =>
2
)
-// Run shrinkwrap against a specified testdir with config items
+// Run shrinkwrap against a specified prefixDir with config items
// and make some assertions that should always be true. Sets
// the results on t.context for use in child tests
-const shrinkwrap = async (t, testdir = {}, config = {}, mocks = {}) => {
+const shrinkwrap = async (t, prefixDir = {}, config = {}, mocks = {}) => {
const { npm, logs } = await loadMockNpm(t, {
mocks,
config,
- testdir,
+ prefixDir,
})
await npm.exec('shrinkwrap', [])
@@ -38,7 +38,7 @@ const shrinkwrap = async (t, testdir = {}, config = {}, mocks = {}) => {
t.same(logs.warn, [], 'no warnings')
t.teardown(() => delete t.context)
t.context = {
- localPrefix: testdir,
+ localPrefix: prefixDir,
config,
shrinkwrap: JSON.parse(fs.readFileSync(newFile)),
logs: logs.notice.map(([, m]) => m),
diff --git a/deps/npm/test/lib/commands/start.js b/deps/npm/test/lib/commands/start.js
index 4f7dc366dbc196..c9312c8e2adc7d 100644
--- a/deps/npm/test/lib/commands/start.js
+++ b/deps/npm/test/lib/commands/start.js
@@ -15,7 +15,7 @@ const makeSpawnArgs = require('@npmcli/run-script/lib/make-spawn-args.js')
t.test('should run start script from package.json', async t => {
t.plan(2)
const { npm } = await loadMockNpm(t, {
- testdir: {
+ prefixDir: {
'package.json': JSON.stringify({
name: 'x',
version: '1.2.3',
diff --git a/deps/npm/test/lib/commands/stop.js b/deps/npm/test/lib/commands/stop.js
index 53d057b711306e..f5db4a047d3f7b 100644
--- a/deps/npm/test/lib/commands/stop.js
+++ b/deps/npm/test/lib/commands/stop.js
@@ -14,7 +14,7 @@ const makeSpawnArgs = require('@npmcli/run-script/lib/make-spawn-args.js')
t.test('should run stop script from package.json', async t => {
const { npm } = await loadMockNpm(t, {
- testdir: {
+ prefixDir: {
'package.json': JSON.stringify({
name: 'x',
version: '1.2.3',
diff --git a/deps/npm/test/lib/commands/test.js b/deps/npm/test/lib/commands/test.js
index a3dbd3ff4cffb7..665df7148a0e5c 100644
--- a/deps/npm/test/lib/commands/test.js
+++ b/deps/npm/test/lib/commands/test.js
@@ -14,7 +14,7 @@ const makeSpawnArgs = require('@npmcli/run-script/lib/make-spawn-args.js')
t.test('should run test script from package.json', async t => {
const { npm } = await loadMockNpm(t, {
- testdir: {
+ prefixDir: {
'package.json': JSON.stringify({
name: 'x',
version: '1.2.3',
diff --git a/deps/npm/test/lib/npm.js b/deps/npm/test/lib/npm.js
index b2eedde72bc9d0..3ae2af35c287d5 100644
--- a/deps/npm/test/lib/npm.js
+++ b/deps/npm/test/lib/npm.js
@@ -77,7 +77,7 @@ t.test('npm.load', async t => {
t.test('basic loading', async t => {
const { npm, logs, prefix: dir, cache } = await loadMockNpm(t, {
- testdir: { node_modules: {} },
+ prefixDir: { node_modules: {} },
})
t.equal(npm.loaded, true)
@@ -165,7 +165,7 @@ t.test('npm.load', async t => {
],
})
const { npm, logs, outputs, prefix } = await loadMockNpm(t, {
- testdir: {
+ prefixDir: {
bin: t.fixture('symlink', dirname(process.execPath)),
},
globals: ({ prefix }) => ({
@@ -237,7 +237,7 @@ t.test('npm.load', async t => {
})
const { npm } = await loadMockNpm(t, {
load: false,
- testdir: {
+ prefixDir: {
packages: {
a: {
'package.json': JSON.stringify({
@@ -270,7 +270,7 @@ t.test('npm.load', async t => {
],
})
const { npm, outputs } = await loadMockNpm(t, {
- testdir: {
+ prefixDir: {
packages: {
a: {
'package.json': JSON.stringify({
@@ -329,7 +329,7 @@ t.test('npm.load', async t => {
],
})
const { npm } = await loadMockNpm(t, {
- testdir: {
+ prefixDir: {
packages: {
a: {
'package.json': JSON.stringify({
@@ -531,7 +531,7 @@ t.test('explicit workspace rejection', async t => {
],
})
const mock = await loadMockNpm(t, {
- testdir: {
+ prefixDir: {
packages: {
a: {
'package.json': JSON.stringify({
@@ -556,7 +556,7 @@ t.test('explicit workspace rejection', async t => {
t.test('implicit workspace rejection', async t => {
const mock = await loadMockNpm(t, {
- testdir: {
+ prefixDir: {
packages: {
a: {
'package.json': JSON.stringify({
@@ -590,7 +590,7 @@ t.test('implicit workspace rejection', async t => {
t.test('implicit workspace accept', async t => {
const mock = await loadMockNpm(t, {
- testdir: {
+ prefixDir: {
packages: {
a: {
'package.json': JSON.stringify({
diff --git a/deps/npm/test/lib/utils/error-message.js b/deps/npm/test/lib/utils/error-message.js
index ddc88c1d990b09..3fec501ef9ff76 100644
--- a/deps/npm/test/lib/utils/error-message.js
+++ b/deps/npm/test/lib/utils/error-message.js
@@ -16,10 +16,10 @@ mockGlobals(t, {
},
})
-const loadMockNpm = async (t, { load, command, testdir, config } = {}) => {
+const loadMockNpm = async (t, { load, command, prefixDir, config } = {}) => {
const { npm, ...rest } = await _loadMockNpm(t, {
load,
- testdir,
+ prefixDir,
config,
mocks: {
'../../package.json': {
@@ -210,7 +210,7 @@ t.test('json parse', t => {
mockGlobals(t, { 'process.argv': ['arg', 'v'] })
t.test('merge conflict in package.json', async t => {
- const testdir = {
+ const prefixDir = {
'package.json': `
{
"array": [
@@ -250,7 +250,7 @@ t.test('json parse', t => {
}
`,
}
- const npm = await loadMockNpm(t, { testdir })
+ const npm = await loadMockNpm(t, { prefixDir })
t.matchSnapshot(errorMessage(Object.assign(new Error('conflicted'), {
code: 'EJSONPARSE',
path: path.resolve(npm.prefix, 'package.json'),
@@ -259,10 +259,10 @@ t.test('json parse', t => {
})
t.test('just regular bad json in package.json', async t => {
- const testdir = {
+ const prefixDir = {
'package.json': 'not even slightly json',
}
- const npm = await loadMockNpm(t, { testdir })
+ const npm = await loadMockNpm(t, { prefixDir })
t.matchSnapshot(errorMessage(Object.assign(new Error('not json'), {
code: 'EJSONPARSE',
path: path.resolve(npm.prefix, 'package.json'),
@@ -271,10 +271,10 @@ t.test('json parse', t => {
})
t.test('json somewhere else', async t => {
- const testdir = {
+ const prefixDir = {
'blerg.json': 'not even slightly json',
}
- const npm = await loadMockNpm(t, { testdir })
+ const npm = await loadMockNpm(t, { prefixDir })
t.matchSnapshot(errorMessage(Object.assign(new Error('not json'), {
code: 'EJSONPARSE',
path: path.resolve(npm.prefix, 'blerg.json'),