summaryrefslogtreecommitdiff
path: root/deps/npm/test
diff options
context:
space:
mode:
authorisaacs <nope@not.real>2019-07-03 10:23:19 -0700
committerRich Trott <rtrott@gmail.com>2019-07-18 15:12:49 -0700
commit1721034a40c5e7a0a334701dc36153adee3f27e5 (patch)
tree7b2ce5a0c5d67d2e1d817fc548571250e8c1a305 /deps/npm/test
parent6df7b6a4f9cb64d298e7fd0691c4d09679872922 (diff)
downloadandroid-node-v8-1721034a40c5e7a0a334701dc36153adee3f27e5.tar.gz
android-node-v8-1721034a40c5e7a0a334701dc36153adee3f27e5.tar.bz2
android-node-v8-1721034a40c5e7a0a334701dc36153adee3f27e5.zip
deps: upgrade npm to 6.10.0
PR-URL: https://github.com/nodejs/node/pull/28525 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Diffstat (limited to 'deps/npm/test')
-rw-r--r--deps/npm/test/common-config.js90
-rw-r--r--deps/npm/test/common-tap.js35
-rw-r--r--deps/npm/test/fake-registry.js9
-rw-r--r--deps/npm/test/fixtures/config/userconfig-with-gc23
-rw-r--r--deps/npm/test/need-npm5-update/ignore-shrinkwrap.js6
-rw-r--r--deps/npm/test/need-npm5-update/peer-deps-invalid.js4
-rw-r--r--deps/npm/test/network/registry.js34
-rw-r--r--deps/npm/test/tap/404-parent.js5
-rw-r--r--deps/npm/test/tap/404-private-registry-scoped.js3
-rw-r--r--deps/npm/test/tap/404-private-registry.js2
-rw-r--r--deps/npm/test/tap/404.js2
-rw-r--r--deps/npm/test/tap/access.js9
-rw-r--r--deps/npm/test/tap/add-named-update-protocol-port.js12
-rw-r--r--deps/npm/test/tap/add-remote-git-file.js4
-rw-r--r--deps/npm/test/tap/add-remote-git-shrinkwrap.js10
-rw-r--r--deps/npm/test/tap/add-remote-git-submodule.js10
-rw-r--r--deps/npm/test/tap/add-remote-git.js11
-rw-r--r--deps/npm/test/tap/adduser-always-auth.js6
-rw-r--r--deps/npm/test/tap/adduser-legacy-auth.js7
-rw-r--r--deps/npm/test/tap/adduser-oauth.js4
-rw-r--r--deps/npm/test/tap/adduser-saml.js4
-rw-r--r--deps/npm/test/tap/aliases.js10
-rw-r--r--deps/npm/test/tap/all-package-metadata-cache-stream-unit.js4
-rw-r--r--deps/npm/test/tap/all-package-metadata-entry-stream-unit.js2
-rw-r--r--deps/npm/test/tap/all-package-metadata-update-stream-unit.js2
-rw-r--r--deps/npm/test/tap/all-package-metadata-write-stream-unit.js2
-rw-r--r--deps/npm/test/tap/all-package-metadata.js2
-rw-r--r--deps/npm/test/tap/anon-cli-metrics.js2
-rw-r--r--deps/npm/test/tap/audit-fix.js2
-rw-r--r--deps/npm/test/tap/audit.js216
-rw-r--r--deps/npm/test/tap/auto-prune.js2
-rw-r--r--deps/npm/test/tap/bearer-token-check.js2
-rw-r--r--deps/npm/test/tap/bin.js8
-rw-r--r--deps/npm/test/tap/bitbucket-https-url-with-creds-package.js2
-rw-r--r--deps/npm/test/tap/bitbucket-https-url-with-creds.js2
-rw-r--r--deps/npm/test/tap/bitbucket-shortcut-package.js2
-rw-r--r--deps/npm/test/tap/bitbucket-shortcut.js2
-rw-r--r--deps/npm/test/tap/bugs.js24
-rw-r--r--deps/npm/test/tap/build-already-built.js3
-rw-r--r--deps/npm/test/tap/builtin-config.js2
-rw-r--r--deps/npm/test/tap/bundled-dependencies-nonarray.js2
-rw-r--r--deps/npm/test/tap/bundled-dependencies.js2
-rw-r--r--deps/npm/test/tap/bundled-transitive-deps.js2
-rw-r--r--deps/npm/test/tap/cache-add-unpublished.js4
-rw-r--r--deps/npm/test/tap/cache-shasum-fork.js2
-rw-r--r--deps/npm/test/tap/check-cpu-reqs.js2
-rw-r--r--deps/npm/test/tap/check-engine-reqs.js2
-rw-r--r--deps/npm/test/tap/check-install-self.js2
-rw-r--r--deps/npm/test/tap/check-os-reqs.js2
-rw-r--r--deps/npm/test/tap/check-permissions.js3
-rw-r--r--deps/npm/test/tap/ci-header.js2
-rw-r--r--deps/npm/test/tap/ci.js30
-rw-r--r--deps/npm/test/tap/circular-dep.js2
-rw-r--r--deps/npm/test/tap/config-basic.js12
-rw-r--r--deps/npm/test/tap/config-builtin.js2
-rw-r--r--deps/npm/test/tap/config-certfile.js2
-rw-r--r--deps/npm/test/tap/config-credentials.js2
-rw-r--r--deps/npm/test/tap/config-edit.js2
-rw-r--r--deps/npm/test/tap/config-envReplace.js3
-rw-r--r--deps/npm/test/tap/config-list.js2
-rw-r--r--deps/npm/test/tap/config-malformed.js2
-rw-r--r--deps/npm/test/tap/config-new-cafile.js10
-rw-r--r--deps/npm/test/tap/config-private.js2
-rw-r--r--deps/npm/test/tap/config-project.js2
-rw-r--r--deps/npm/test/tap/config-save.js14
-rw-r--r--deps/npm/test/tap/correct-mkdir.js4
-rw-r--r--deps/npm/test/tap/cruft-test.js2
-rw-r--r--deps/npm/test/tap/debug-logs.js20
-rw-r--r--deps/npm/test/tap/dedupe-git-semver.js3
-rw-r--r--deps/npm/test/tap/dedupe-scoped.js2
-rw-r--r--deps/npm/test/tap/dedupe.js2
-rw-r--r--deps/npm/test/tap/dist-tag.js2
-rw-r--r--deps/npm/test/tap/do-not-remove-other-bins.js2
-rw-r--r--deps/npm/test/tap/doctor.js2
-rw-r--r--deps/npm/test/tap/extraneous-dep-cycle-ls-ok.js2
-rw-r--r--deps/npm/test/tap/false-name.js2
-rw-r--r--deps/npm/test/tap/fetch-package-metadata.js4
-rw-r--r--deps/npm/test/tap/full-warning-messages.js2
-rw-r--r--deps/npm/test/tap/gently-rm-cmdshims.js3
-rw-r--r--deps/npm/test/tap/gently-rm-linked-module.js3
-rw-r--r--deps/npm/test/tap/gently-rm-overeager.js2
-rw-r--r--deps/npm/test/tap/gently-rm-symlinked-global-dir.js8
-rw-r--r--deps/npm/test/tap/gist-short-shortcut-package.js2
-rw-r--r--deps/npm/test/tap/gist-short-shortcut.js2
-rw-r--r--deps/npm/test/tap/gist-shortcut-package.js2
-rw-r--r--deps/npm/test/tap/gist-shortcut.js2
-rw-r--r--deps/npm/test/tap/git-dependency-install-link.js10
-rw-r--r--deps/npm/test/tap/git-npmignore.js3
-rw-r--r--deps/npm/test/tap/git-prepare.js6
-rw-r--r--deps/npm/test/tap/github-shortcut-package.js2
-rw-r--r--deps/npm/test/tap/github-shortcut.js2
-rw-r--r--deps/npm/test/tap/gitlab-shortcut-package.js2
-rw-r--r--deps/npm/test/tap/gitlab-shortcut.js2
-rw-r--r--deps/npm/test/tap/graceful-restart.js2
-rw-r--r--deps/npm/test/tap/ignore-install-link.js2
-rw-r--r--deps/npm/test/tap/ignore-scripts.js2
-rw-r--r--deps/npm/test/tap/init-interrupt.js4
-rw-r--r--deps/npm/test/tap/install-at-locally.js2
-rw-r--r--deps/npm/test/tap/install-at-sub-path-locally.js2
-rw-r--r--deps/npm/test/tap/install-bad-dep-format.js6
-rw-r--r--deps/npm/test/tap/install-bad-man.js4
-rw-r--r--deps/npm/test/tap/install-before.js2
-rw-r--r--deps/npm/test/tap/install-bin-null.js2
-rw-r--r--deps/npm/test/tap/install-cli-only-development.js2
-rw-r--r--deps/npm/test/tap/install-cli-only-production.js2
-rw-r--r--deps/npm/test/tap/install-cli-only-shrinkwrap.js2
-rw-r--r--deps/npm/test/tap/install-cli-production-nosave.js2
-rw-r--r--deps/npm/test/tap/install-cli-production.js2
-rw-r--r--deps/npm/test/tap/install-cli-unicode.js2
-rw-r--r--deps/npm/test/tap/install-contributors-count.js3
-rw-r--r--deps/npm/test/tap/install-dep-classification.js2
-rw-r--r--deps/npm/test/tap/install-duplicate-deps-warning.js2
-rw-r--r--deps/npm/test/tap/install-from-local.js2
-rw-r--r--deps/npm/test/tap/install-into-likenamed-folder.js2
-rw-r--r--deps/npm/test/tap/install-link-scripts.js2
-rw-r--r--deps/npm/test/tap/install-local-dep-cycle.js2
-rw-r--r--deps/npm/test/tap/install-man.js4
-rw-r--r--deps/npm/test/tap/install-noargs-dev.js2
-rw-r--r--deps/npm/test/tap/install-package-json-order.js3
-rw-r--r--deps/npm/test/tap/install-package-lock-only.js2
-rw-r--r--deps/npm/test/tap/install-parse-error.js3
-rw-r--r--deps/npm/test/tap/install-property-conflicts.js2
-rw-r--r--deps/npm/test/tap/install-report-just-installed.js3
-rw-r--r--deps/npm/test/tap/install-save-consistent-newlines.js2
-rw-r--r--deps/npm/test/tap/install-save-exact.js2
-rw-r--r--deps/npm/test/tap/install-save-local.js2
-rw-r--r--deps/npm/test/tap/install-save-prefix.js2
-rw-r--r--deps/npm/test/tap/install-scoped-already-installed.js2
-rw-r--r--deps/npm/test/tap/install-scoped-link.js4
-rw-r--r--deps/npm/test/tap/install-scoped-with-bundled-dependency.js2
-rw-r--r--deps/npm/test/tap/install-scoped-with-peer-dependency.js2
-rw-r--r--deps/npm/test/tap/install-shrinkwrapped-git.js14
-rw-r--r--deps/npm/test/tap/install-test-cli-without-package-lock.js2
-rw-r--r--deps/npm/test/tap/install-windows-newlines.js2
-rw-r--r--deps/npm/test/tap/install-with-dev-dep-duplicate.js2
-rw-r--r--deps/npm/test/tap/invalid-dep-version-filtering.js2
-rw-r--r--deps/npm/test/tap/it.js2
-rw-r--r--deps/npm/test/tap/legacy-ignore-nested-nm.js2
-rw-r--r--deps/npm/test/tap/legacy-missing-bindir.js2
-rw-r--r--deps/npm/test/tap/legacy-no-auth-leak.js3
-rw-r--r--deps/npm/test/tap/legacy-platform-all.js3
-rw-r--r--deps/npm/test/tap/legacy-platform.js2
-rw-r--r--deps/npm/test/tap/legacy-private.js2
-rw-r--r--deps/npm/test/tap/legacy-test-package.js2
-rw-r--r--deps/npm/test/tap/lifecycle-INIT_CWD.js2
-rw-r--r--deps/npm/test/tap/lifecycle-order.js2
-rw-r--r--deps/npm/test/tap/link.js8
-rw-r--r--deps/npm/test/tap/local-args-relative-to-cwd.js2
-rw-r--r--deps/npm/test/tap/locker.js3
-rw-r--r--deps/npm/test/tap/lockfile-http-deps.js2
-rw-r--r--deps/npm/test/tap/logout-scoped.js11
-rw-r--r--deps/npm/test/tap/logout.js9
-rw-r--r--deps/npm/test/tap/ls-depth-cli.js8
-rw-r--r--deps/npm/test/tap/ls-depth-unmet.js2
-rw-r--r--deps/npm/test/tap/ls-env.js2
-rw-r--r--deps/npm/test/tap/ls-l-depth-0.js2
-rw-r--r--deps/npm/test/tap/ls-peer.js2
-rw-r--r--deps/npm/test/tap/ls-production-and-dev.js2
-rw-r--r--deps/npm/test/tap/ls-top-errors.js2
-rw-r--r--deps/npm/test/tap/ls.js2
-rw-r--r--deps/npm/test/tap/nested-extraneous.js2
-rw-r--r--deps/npm/test/tap/no-global-warns.js2
-rw-r--r--deps/npm/test/tap/no-scan-full-global-dir.js27
-rw-r--r--deps/npm/test/tap/noargs-install-config-save.js6
-rw-r--r--deps/npm/test/tap/node-modules-path-munge.js2
-rw-r--r--deps/npm/test/tap/npm-api-not-loaded-error.js3
-rw-r--r--deps/npm/test/tap/onload.js4
-rw-r--r--deps/npm/test/tap/optional-metadep-rollback-collision.js2
-rw-r--r--deps/npm/test/tap/outdated-color.js2
-rw-r--r--deps/npm/test/tap/outdated-depth.js2
-rw-r--r--deps/npm/test/tap/outdated-git.js2
-rw-r--r--deps/npm/test/tap/outdated-json.js44
-rw-r--r--deps/npm/test/tap/outdated-latest.js2
-rw-r--r--deps/npm/test/tap/outdated-long.js2
-rw-r--r--deps/npm/test/tap/outdated-remote.js95
-rw-r--r--deps/npm/test/tap/outdated-symlink.js2
-rw-r--r--deps/npm/test/tap/outdated.js2
-rw-r--r--deps/npm/test/tap/override-bundled.js2
-rw-r--r--deps/npm/test/tap/owner.js2
-rw-r--r--deps/npm/test/tap/pack-files-and-ignores.js4
-rw-r--r--deps/npm/test/tap/pack-scoped.js2
-rw-r--r--deps/npm/test/tap/pack.js2
-rw-r--r--deps/npm/test/tap/peer-deps.js2
-rw-r--r--deps/npm/test/tap/ping.js2
-rw-r--r--deps/npm/test/tap/prepare.js2
-rw-r--r--deps/npm/test/tap/prepublish-only.js2
-rw-r--r--deps/npm/test/tap/prepublish.js2
-rw-r--r--deps/npm/test/tap/progress-config.js4
-rw-r--r--deps/npm/test/tap/prune-dev-dep-cycle.js3
-rw-r--r--deps/npm/test/tap/prune-dev-dep-with-bins.js3
-rw-r--r--deps/npm/test/tap/prune-with-dev-dep-duplicate.js2
-rw-r--r--deps/npm/test/tap/prune-with-only-dev-deps.js2
-rw-r--r--deps/npm/test/tap/prune.js2
-rw-r--r--deps/npm/test/tap/publish-access-scoped.js2
-rw-r--r--deps/npm/test/tap/publish-access-unscoped-restricted-fails.js2
-rw-r--r--deps/npm/test/tap/publish-access-unscoped.js2
-rw-r--r--deps/npm/test/tap/publish-config.js6
-rw-r--r--deps/npm/test/tap/publish-invalid-semver-tag.js2
-rw-r--r--deps/npm/test/tap/publish-scoped.js8
-rw-r--r--deps/npm/test/tap/publish.js10
-rw-r--r--deps/npm/test/tap/repo.js11
-rw-r--r--deps/npm/test/tap/retry-on-stale-cache.js2
-rw-r--r--deps/npm/test/tap/run-script-filter-private.js2
-rw-r--r--deps/npm/test/tap/run-script.js2
-rw-r--r--deps/npm/test/tap/save-optional.js2
-rw-r--r--deps/npm/test/tap/scope-header.js2
-rw-r--r--deps/npm/test/tap/scripts-whitespace-windows.js2
-rw-r--r--deps/npm/test/tap/search.all-package-search.js2
-rw-r--r--deps/npm/test/tap/search.js2
-rw-r--r--deps/npm/test/tap/shared-linked.js2
-rw-r--r--deps/npm/test/tap/shrinkwrap-_auth.js2
-rw-r--r--deps/npm/test/tap/shrinkwrap-default-dev.js2
-rw-r--r--deps/npm/test/tap/shrinkwrap-dev-dependency.js2
-rw-r--r--deps/npm/test/tap/shrinkwrap-empty-deps.js2
-rw-r--r--deps/npm/test/tap/shrinkwrap-extra-metadata.js2
-rw-r--r--deps/npm/test/tap/shrinkwrap-global-auth.js2
-rw-r--r--deps/npm/test/tap/shrinkwrap-lifecycle-cwd.js2
-rw-r--r--deps/npm/test/tap/shrinkwrap-lifecycle.js2
-rw-r--r--deps/npm/test/tap/shrinkwrap-local-dependency.js2
-rw-r--r--deps/npm/test/tap/shrinkwrap-nested.js2
-rw-r--r--deps/npm/test/tap/shrinkwrap-optional-dependency.js2
-rw-r--r--deps/npm/test/tap/shrinkwrap-optional-platform.js2
-rw-r--r--deps/npm/test/tap/shrinkwrap-optional-property.js4
-rw-r--r--deps/npm/test/tap/shrinkwrap-prod-dependency-also.js2
-rw-r--r--deps/npm/test/tap/shrinkwrap-prod-dependency.js2
-rw-r--r--deps/npm/test/tap/shrinkwrap-resolve-conflict.js2
-rw-r--r--deps/npm/test/tap/shrinkwrap-save-dev-with-existing-deps.js2
-rw-r--r--deps/npm/test/tap/shrinkwrap-save-with-existing-dev-deps.js2
-rw-r--r--deps/npm/test/tap/shrinkwrap-scoped-auth.js2
-rw-r--r--deps/npm/test/tap/shrinkwrap-shared-dev-dependency.js2
-rw-r--r--deps/npm/test/tap/shrinkwrap-version-match.js2
-rw-r--r--deps/npm/test/tap/sorted-package-json.js4
-rw-r--r--deps/npm/test/tap/spawn-enoent-help.js3
-rw-r--r--deps/npm/test/tap/spawn-enoent.js3
-rw-r--r--deps/npm/test/tap/spec-local-specifiers.js2
-rw-r--r--deps/npm/test/tap/splat-with-only-prerelease-to-latest.js2
-rw-r--r--deps/npm/test/tap/startstop.js2
-rw-r--r--deps/npm/test/tap/symlink-cycle.js2
-rw-r--r--deps/npm/test/tap/tag-version-prefix.js2
-rw-r--r--deps/npm/test/tap/tagged-version-matching.js2
-rw-r--r--deps/npm/test/tap/tree-style.js2
-rw-r--r--deps/npm/test/tap/umask-lifecycle.js5
-rw-r--r--deps/npm/test/tap/uninstall-link-clean.js2
-rw-r--r--deps/npm/test/tap/uninstall-package.js26
-rw-r--r--deps/npm/test/tap/uninstall-save.js2
-rw-r--r--deps/npm/test/tap/unpack-foreign-tarball.js2
-rw-r--r--deps/npm/test/tap/unpublish-config.js7
-rw-r--r--deps/npm/test/tap/unsupported.js4
-rw-r--r--deps/npm/test/tap/update-examples.js2
-rw-r--r--deps/npm/test/tap/update-symlink.js2
-rw-r--r--deps/npm/test/tap/upgrade-lifecycles.js2
-rw-r--r--deps/npm/test/tap/url-dependencies.js2
-rw-r--r--deps/npm/test/tap/verify-no-lifecycle-on-repo.js4
-rw-r--r--deps/npm/test/tap/version-allow-same-version.js2
-rw-r--r--deps/npm/test/tap/version-commit-hooks.js3
-rw-r--r--deps/npm/test/tap/version-consistent-newlines.js2
-rw-r--r--deps/npm/test/tap/version-from-git.js2
-rw-r--r--deps/npm/test/tap/version-git-not-clean.js2
-rw-r--r--deps/npm/test/tap/version-lifecycle.js2
-rw-r--r--deps/npm/test/tap/version-message-config.js2
-rw-r--r--deps/npm/test/tap/version-no-git.js2
-rw-r--r--deps/npm/test/tap/version-no-package.js3
-rw-r--r--deps/npm/test/tap/version-no-tags.js2
-rw-r--r--deps/npm/test/tap/version-prerelease-id.js2
-rw-r--r--deps/npm/test/tap/version-sub-directory-shrinkwrap.js2
-rw-r--r--deps/npm/test/tap/version-sub-directory.js2
-rw-r--r--deps/npm/test/tap/version-update-shrinkwrap.js2
267 files changed, 968 insertions, 476 deletions
diff --git a/deps/npm/test/common-config.js b/deps/npm/test/common-config.js
new file mode 100644
index 0000000000..0031503354
--- /dev/null
+++ b/deps/npm/test/common-config.js
@@ -0,0 +1,90 @@
+if (module === require.main) {
+ console.log('1..1')
+ console.log('ok 1 setup done')
+ process.exit(0)
+}
+
+var fs = require('graceful-fs')
+var path = require('path')
+var userconfigSrc = path.resolve(__dirname, 'fixtures', 'config', 'userconfig')
+exports.userconfig = userconfigSrc + '-with-gc'
+exports.globalconfig = path.resolve(__dirname, 'fixtures', 'config', 'globalconfig')
+
+// if this hasn't been written yet, then do it now.
+try {
+ fs.statSync(exports.userconfig)
+} catch (er) {
+ var uc = fs.readFileSync(userconfigSrc)
+ var gcini = 'globalconfig = ' + exports.globalconfig + '\n'
+ // atomic!
+ fs.writeFileSync(exports.userconfig + '.' + process.pid, gcini + uc)
+ fs.renameSync(exports.userconfig + '.' + process.pid, exports.userconfig)
+}
+
+exports.builtin = path.resolve(__dirname, 'fixtures', 'config', 'builtin')
+exports.malformed = path.resolve(__dirname, 'fixtures', 'config', 'malformed')
+exports.ucData =
+ { globalconfig: exports.globalconfig,
+ email: 'i@izs.me',
+ 'env-thing': 'asdf',
+ 'init.author.name': 'Isaac Z. Schlueter',
+ 'init.author.email': 'i@izs.me',
+ 'init.author.url': 'http://blog.izs.me/',
+ 'init.version': '1.2.3',
+ 'npm:publishtest': true,
+ '_npmjs.org:couch': 'https://admin:password@localhost:5984/registry',
+ 'npm-www:nocache': '1',
+ nodedir: '/Users/isaacs/dev/js/node-v0.8',
+ 'sign-git-tag': true,
+ message: 'v%s',
+ 'strict-ssl': false,
+ 'tmp': path.normalize(process.env.HOME + '/.tmp'),
+ _auth: 'dXNlcm5hbWU6cGFzc3dvcmQ=',
+ _token:
+ { AuthSession: 'yabba-dabba-doodle',
+ version: '1',
+ expires: '1345001053415',
+ path: '/',
+ httponly: true } }
+
+// set the userconfig in the env
+// unset anything else that npm might be trying to foist on us
+Object.keys(process.env).forEach(function (k) {
+ if (k.match(/^npm_config_/i)) {
+ delete process.env[k]
+ }
+})
+process.env.npm_config_userconfig = exports.userconfig
+process.env.npm_config_other_env_thing = '1000'
+process.env.random_env_var = 'asdf'
+process.env.npm_config__underbar_env_thing = 'underful'
+process.env.NPM_CONFIG_UPPERCASE_ENV_THING = '42'
+
+exports.envData = {
+ userconfig: exports.userconfig,
+ '_underbar-env-thing': 'underful',
+ 'uppercase-env-thing': '42',
+ 'other-env-thing': '1000'
+}
+exports.envDataFix = {
+ userconfig: exports.userconfig,
+ '_underbar-env-thing': 'underful',
+ 'uppercase-env-thing': 42,
+ 'other-env-thing': 1000
+}
+
+var projectConf = path.resolve(__dirname, '..', '.npmrc')
+try {
+ fs.statSync(projectConf)
+} catch (er) {
+ // project conf not found, probably working with packed npm
+ fs.writeFileSync(projectConf, '')
+}
+
+var projectRc = path.join(__dirname, 'fixtures', 'config', '.npmrc')
+try {
+ fs.statSync(projectRc)
+} catch (er) {
+ // project conf not found, probably working with packed npm
+ fs.writeFileSync(projectRc, 'just = testing')
+}
diff --git a/deps/npm/test/common-tap.js b/deps/npm/test/common-tap.js
index 37d5efe9f8..d54a869995 100644
--- a/deps/npm/test/common-tap.js
+++ b/deps/npm/test/common-tap.js
@@ -1,6 +1,7 @@
'use strict'
/* eslint-disable camelcase */
+const configCommon = require('./common-config.js')
var fs = require('graceful-fs')
var readCmdShim = require('read-cmd-shim')
var isWindows = require('../lib/utils/is-windows.js')
@@ -17,9 +18,32 @@ if (!global.setImmediate || !require('timers').setImmediate) {
var spawn = require('child_process').spawn
var path = require('path')
-var port = exports.port = 1337
+// provide a working dir unique to each test
+const main = require.main.filename
+exports.pkg = path.resolve(path.dirname(main), path.basename(main, '.js'))
+const mkdirp = require('mkdirp')
+const rimraf = require('rimraf')
+mkdirp.sync(exports.pkg)
+require('tap').teardown(() => {
+ try {
+ rimraf.sync(exports.pkg)
+ } catch (e) {
+ if (process.platform !== 'win32') {
+ throw e
+ }
+ }
+})
+
+// space these out to help prevent collisions
+const testId = 3 * (+process.env.TAP_CHILD_ID || 0)
+
+var port = exports.port = 15443 + testId
exports.registry = 'http://localhost:' + port
+exports.altPort = 7331 + testId
+
+exports.gitPort = 4321 + testId
+
var fakeRegistry = require('./fake-registry.js')
exports.fakeRegistry = fakeRegistry
@@ -29,10 +53,10 @@ ourenv.npm_config_progress = 'false'
ourenv.npm_config_metrics = 'false'
ourenv.npm_config_audit = 'false'
-var npm_config_cache = path.resolve(__dirname, 'npm_cache')
+var npm_config_cache = path.resolve(__dirname, 'npm_cache_' + testId)
ourenv.npm_config_cache = exports.npm_config_cache = npm_config_cache
-ourenv.npm_config_userconfig = exports.npm_config_userconfig = path.join(__dirname, 'fixtures', 'config', 'userconfig')
-ourenv.npm_config_globalconfig = exports.npm_config_globalconfig = path.join(__dirname, 'fixtures', 'config', 'globalconfig')
+ourenv.npm_config_userconfig = exports.npm_config_userconfig = configCommon.userconfig
+ourenv.npm_config_globalconfig = exports.npm_config_globalconfig = configCommon.globalconfig
ourenv.npm_config_global_style = 'false'
ourenv.npm_config_legacy_bundling = 'false'
ourenv.npm_config_fetch_retries = '0'
@@ -114,6 +138,9 @@ exports.makeGitRepo = function (params, cb) {
git.chainableExec(['init'], opts),
git.chainableExec(['config', 'user.name', user], opts),
git.chainableExec(['config', 'user.email', email], opts),
+ // don't time out tests waiting for a gpg passphrase or 2fa
+ git.chainableExec(['config', 'commit.gpgsign', 'false'], opts),
+ git.chainableExec(['config', 'tag.forceSignAnnotated', 'false'], opts),
git.chainableExec(['add'].concat(added), opts),
git.chainableExec(['commit', '-m', message], opts)
]
diff --git a/deps/npm/test/fake-registry.js b/deps/npm/test/fake-registry.js
index 7566443e64..e09e154c76 100644
--- a/deps/npm/test/fake-registry.js
+++ b/deps/npm/test/fake-registry.js
@@ -1,7 +1,14 @@
'use strict'
const common = require('./common-tap.js')
const Bluebird = require('bluebird')
-const log = require('npmlog')
+const silentLogger = {
+ http: () => {},
+ silly: () => {}
+}
+
+const log = process.env.TAP_CHILD_ID
+ ? silentLogger
+ : require('npmlog')
const http = require('http')
const EventEmitter = require('events')
diff --git a/deps/npm/test/fixtures/config/userconfig-with-gc b/deps/npm/test/fixtures/config/userconfig-with-gc
new file mode 100644
index 0000000000..cf774bb883
--- /dev/null
+++ b/deps/npm/test/fixtures/config/userconfig-with-gc
@@ -0,0 +1,23 @@
+globalconfig = /Users/isaacs/dev/npm/cli/test/fixtures/config/globalconfig
+email = i@izs.me
+env-thing = ${random_env_var}
+init.author.name = Isaac Z. Schlueter
+init.author.email = i@izs.me
+init.author.url = http://blog.izs.me/
+init.version = 1.2.3
+npm:publishtest = true
+_npmjs.org:couch = https://admin:password@localhost:5984/registry
+npm-www:nocache = 1
+nodedir = /Users/isaacs/dev/js/node-v0.8
+sign-git-tag = true
+message = v%s
+strict-ssl = false
+tmp = ~/.tmp
+_auth = dXNlcm5hbWU6cGFzc3dvcmQ=
+
+[_token]
+AuthSession = yabba-dabba-doodle
+version = 1
+expires = 1345001053415
+path = /
+httponly = true
diff --git a/deps/npm/test/need-npm5-update/ignore-shrinkwrap.js b/deps/npm/test/need-npm5-update/ignore-shrinkwrap.js
index 9468162eee..4980b659fd 100644
--- a/deps/npm/test/need-npm5-update/ignore-shrinkwrap.js
+++ b/deps/npm/test/need-npm5-update/ignore-shrinkwrap.js
@@ -24,7 +24,7 @@ var json = {
name: 'ignore-shrinkwrap',
version: '0.0.0',
dependencies: {
- 'npm-test-ignore-shrinkwrap-file': 'http://localhost:1337/package.js'
+ 'npm-test-ignore-shrinkwrap-file': 'http://localhost:' + common.port + '/package.js'
}
}
@@ -34,8 +34,8 @@ var shrinkwrap = {
dependencies: {
'npm-test-ignore-shrinkwrap-file': {
version: '1.2.3',
- from: 'http://localhost:1337/shrinkwrap.js',
- resolved: 'http://localhost:1337/shrinkwrap.js',
+ from: 'http://localhost:' + common.port + '/shrinkwrap.js',
+ resolved: 'http://localhost:' + common.port + '/shrinkwrap.js',
dependencies: {
opener: {
version: '1.3.0',
diff --git a/deps/npm/test/need-npm5-update/peer-deps-invalid.js b/deps/npm/test/need-npm5-update/peer-deps-invalid.js
index 39ad612e5a..15fda253ec 100644
--- a/deps/npm/test/need-npm5-update/peer-deps-invalid.js
+++ b/deps/npm/test/need-npm5-update/peer-deps-invalid.js
@@ -18,8 +18,8 @@ var json = {
name: 'peer-deps-invalid',
version: '0.0.0',
dependencies: {
- 'npm-test-peer-deps-file': 'http://localhost:1337/ok.js',
- 'npm-test-peer-deps-file-invalid': 'http://localhost:1337/invalid.js'
+ 'npm-test-peer-deps-file': 'http://localhost:' + common.port + '/ok.js',
+ 'npm-test-peer-deps-file-invalid': 'http://localhost:' + common.port + '/invalid.js'
}
}
diff --git a/deps/npm/test/network/registry.js b/deps/npm/test/network/registry.js
index 3dbe23ffd2..d7e11c6007 100644
--- a/deps/npm/test/network/registry.js
+++ b/deps/npm/test/network/registry.js
@@ -2,7 +2,7 @@
// This verifies that the server-side stuff still works.
var common = require('../common-tap')
-var test = require('tap').test
+var t = require('tap')
var npmExec = require.resolve('../../bin/npm-cli.js')
var path = require('path')
@@ -17,16 +17,15 @@ if (v[0] === 0 && v[1] < 10) {
process.versions.node
)
} else {
- which('couchdb', function (er) {
- if (er) {
- console.error('WARNING: need couch to run test: ' + er.message)
- } else {
- runTests()
- }
- })
+ try {
+ which.sync('couchdb')
+ t.test(runTests)
+ } catch (er) {
+ console.error('WARNING: need couch to run test: ' + er.message)
+ }
}
-function runTests () {
+function runTests (t) {
var env = Object.assign({ TAP: 1 }, process.env)
env.npm = npmExec
// TODO: fix tap and / or nyc to handle nested invocations properly
@@ -39,10 +38,8 @@ function runTests () {
common.npm(['install'], opts, function (err, code) {
if (err) { throw err }
if (code) {
- return test('need install to work', function (t) {
- t.fail('install failed with: ' + code)
- t.end()
- })
+ t.fail('install failed with: ' + code)
+ return t.end()
} else {
opts = {
cwd: ca,
@@ -52,10 +49,8 @@ function runTests () {
common.npm(['test', '--', '-Rtap', '--no-coverage'], opts, function (err, code) {
if (err) { throw err }
if (code) {
- return test('need test to work', function (t) {
- t.fail('test failed with: ' + code)
- t.end()
- })
+ t.fail('test failed with: ' + code)
+ return t.end()
}
opts = {
cwd: ca,
@@ -63,8 +58,9 @@ function runTests () {
stdio: 'inherit'
}
common.npm(['prune', '--production'], opts, function (err, code) {
- if (err) { throw err }
- process.exit(code || 0)
+ t.ifError(err)
+ t.equal(code, 0)
+ return t.end()
})
})
}
diff --git a/deps/npm/test/tap/404-parent.js b/deps/npm/test/tap/404-parent.js
index 67835efc1d..539ead7a45 100644
--- a/deps/npm/test/tap/404-parent.js
+++ b/deps/npm/test/tap/404-parent.js
@@ -6,7 +6,7 @@ var path = require('path')
var fs = require('fs')
var rimraf = require('rimraf')
var mkdirp = require('mkdirp')
-var pkg = path.resolve(__dirname, '404-parent')
+const pkg = common.pkg
var mr = require('npm-registry-mock')
test('404-parent: if parent exists, specify parent in error message', function (t) {
@@ -42,6 +42,9 @@ function setup () {
function performInstall (cb) {
mr({port: common.port}, function (er, s) { // create mock registry.
+ if (er) {
+ return cb(er)
+ }
s.get('/test-npm-404-parent-test')
.many().reply(404, {'error': 'version not found'})
npm.load({
diff --git a/deps/npm/test/tap/404-private-registry-scoped.js b/deps/npm/test/tap/404-private-registry-scoped.js
index f8a8c5b05a..5565f7a404 100644
--- a/deps/npm/test/tap/404-private-registry-scoped.js
+++ b/deps/npm/test/tap/404-private-registry-scoped.js
@@ -1,12 +1,11 @@
var test = require('tap').test
-var path = require('path')
var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
var common = require('../common-tap.js')
var mr = common.fakeRegistry.compat
var server
-var testdir = path.join(__dirname, path.basename(__filename, '.js'))
+var testdir = common.pkg
function setup () {
cleanup()
diff --git a/deps/npm/test/tap/404-private-registry.js b/deps/npm/test/tap/404-private-registry.js
index da6e446918..869125eba1 100644
--- a/deps/npm/test/tap/404-private-registry.js
+++ b/deps/npm/test/tap/404-private-registry.js
@@ -7,7 +7,7 @@ var mr = common.fakeRegistry.compat
var server
var packageName = path.basename(__filename, '.js')
-var testdir = path.join(__dirname, packageName)
+var testdir = common.pkg
function setup () {
cleanup()
diff --git a/deps/npm/test/tap/404.js b/deps/npm/test/tap/404.js
index 710780ad26..450b0c2816 100644
--- a/deps/npm/test/tap/404.js
+++ b/deps/npm/test/tap/404.js
@@ -9,7 +9,7 @@ const common = require('../common-tap.js')
const e404 = /test-npm-404@latest' is not in the npm registry/
const invalidPackage = /Your package name is not valid, because[\s\S]+1\. name can only contain URL-friendly characters/
-const basedir = path.join(__dirname, path.basename(__filename, '.js'))
+const basedir = common.pkg
const testdir = path.join(basedir, 'testdir')
const cachedir = path.join(basedir, 'cache')
const globaldir = path.join(basedir, 'global')
diff --git a/deps/npm/test/tap/access.js b/deps/npm/test/tap/access.js
index d400b4d33b..db03cbfc9e 100644
--- a/deps/npm/test/tap/access.js
+++ b/deps/npm/test/tap/access.js
@@ -9,7 +9,8 @@ const mr = require('npm-registry-mock')
const test = require('tap').test
const common = require('../common-tap.js')
-const pkg = path.resolve(__dirname, 'access')
+const pkg = common.pkg
+
let server
const scoped = {
@@ -63,7 +64,7 @@ test('npm access public on current package', function (t) {
test('npm access public when no package passed and no package.json', function (t) {
// need to simulate a missing package.json
- var missing = path.join(__dirname, 'access-public-missing-guard')
+ var missing = path.join(pkg, 'access-public-missing-guard')
mkdirp.sync(path.join(missing, 'node_modules'))
common.npm([
@@ -83,7 +84,7 @@ test('npm access public when no package passed and no package.json', function (t
test('npm access public when no package passed and invalid package.json', function (t) {
// need to simulate a missing package.json
- var invalid = path.join(__dirname, 'access-public-invalid-package')
+ var invalid = path.join(pkg, 'access-public-invalid-package')
mkdirp.sync(path.join(invalid, 'node_modules'))
// it's hard to force `read-package-json` to break w/o ENOENT, but this will do it
fs.writeFileSync(path.join(invalid, 'package.json'), '{\n')
@@ -380,7 +381,7 @@ test('npm access ls-packages on user', function (t) {
test('npm access ls-packages with no package specified or package.json', function (t) {
// need to simulate a missing package.json
- var missing = path.join(__dirname, 'access-missing-guard')
+ var missing = path.join(pkg, 'access-missing-guard')
mkdirp.sync(path.join(missing, 'node_modules'))
var serverPackages = {
diff --git a/deps/npm/test/tap/add-named-update-protocol-port.js b/deps/npm/test/tap/add-named-update-protocol-port.js
index 37851e1068..2876b6cdbc 100644
--- a/deps/npm/test/tap/add-named-update-protocol-port.js
+++ b/deps/npm/test/tap/add-named-update-protocol-port.js
@@ -15,7 +15,7 @@ var fooPkg = {
name: packageName,
version: '0.0.0',
dist: {
- tarball: 'https://localhost:1338/registry/' + packageName + '/-/' + packageName + '-0.0.0.tgz',
+ tarball: 'https://localhost:' + common.altPort + '/registry/' + packageName + '/-/' + packageName + '-0.0.0.tgz',
shasum: '356a192b7913b04c54574d18c28d46e6395428ab'
}
}
@@ -30,7 +30,7 @@ var fooiPkg = {
name: iPackageName,
version: '0.0.0',
dist: {
- tarball: 'http://127.0.0.1:1338/registry/' + iPackageName + '/-/' + iPackageName + '-0.0.0.tgz',
+ tarball: 'http://127.0.0.1:' + common.altPort + '/registry/' + iPackageName + '/-/' + iPackageName + '-0.0.0.tgz',
shasum: '356a192b7913b04c54574d18c28d46e6395428ab'
}
}
@@ -39,13 +39,13 @@ var fooiPkg = {
test('setup', function (t) {
mr({
- port: 1337,
+ port: common.port,
throwOnUnmatched: true
}, function (err, s) {
t.ifError(err, 'registry mocked successfully')
server1 = s
mr({
- port: 1338,
+ port: common.altPort,
throwOnUnmatched: true
}, function (err, s) {
t.ifError(err, 'registry mocked successfully')
@@ -67,7 +67,7 @@ test('tarball paths should update port if updating protocol', function (t) {
'add',
packageName + '@0.0.0',
'--registry',
- 'http://localhost:1337/registry'
+ 'http://localhost:' + common.port + '/registry'
],
{},
function (er, code, stdout, stderr) {
@@ -92,7 +92,7 @@ test('tarball paths should NOT update if different hostname', function (t) {
'add',
iPackageName + '@0.0.0',
'--registry',
- 'http://localhost:1337/registry'
+ 'http://localhost:' + common.port + '/registry'
],
{},
function (er, code, stdout, stderr) {
diff --git a/deps/npm/test/tap/add-remote-git-file.js b/deps/npm/test/tap/add-remote-git-file.js
index 20392af877..7d64609072 100644
--- a/deps/npm/test/tap/add-remote-git-file.js
+++ b/deps/npm/test/tap/add-remote-git-file.js
@@ -13,8 +13,8 @@ var npm = require('../../lib/npm.js')
var fetchPackageMetadata = require('../../lib/fetch-package-metadata.js')
var common = require('../common-tap.js')
-var pkg = resolve(__dirname, 'add-remote-git-file')
-var repo = resolve(__dirname, 'add-remote-git-file-repo')
+var pkg = common.pkg
+var repo = common.pkg + '-repo'
var git
var cloneURL = 'git+file://' + resolve(pkg, 'child.git')
diff --git a/deps/npm/test/tap/add-remote-git-shrinkwrap.js b/deps/npm/test/tap/add-remote-git-shrinkwrap.js
index c7fb2f9b96..0daf2922e7 100644
--- a/deps/npm/test/tap/add-remote-git-shrinkwrap.js
+++ b/deps/npm/test/tap/add-remote-git-shrinkwrap.js
@@ -9,8 +9,8 @@ var test = require('tap').test
var npm = require('../../lib/npm.js')
var common = require('../common-tap.js')
-var pkg = resolve(__dirname, 'add-remote-git-shrinkwrap')
-var repo = resolve(__dirname, 'add-remote-git-shrinkwrap-repo')
+var pkg = common.pkg
+var repo = pkg + '-repo'
var daemon
var daemonPID
@@ -20,7 +20,7 @@ var pjParent = JSON.stringify({
name: 'parent',
version: '1.2.3',
dependencies: {
- 'child': 'git://localhost:1234/child.git#master'
+ 'child': 'git://localhost:' + common.gitPort + '/child.git#master'
}
}, null, 2) + '\n'
@@ -73,7 +73,7 @@ test('shrinkwrap gets correct _from and _resolved (#7121)', function (t) {
t.notOk(stderr, 'no error output')
var treeish = stdout.trim()
- t.like(shrinkwrap, {dependencies: {child: {version: 'git://localhost:1234/child.git#' + treeish}}},
+ t.like(shrinkwrap, {dependencies: {child: {version: 'git://localhost:' + common.gitPort + '/child.git#' + treeish}}},
'npm shrinkwrapped resolved correctly'
)
@@ -114,7 +114,7 @@ function setup (cb) {
'--export-all',
'--base-path=.',
'--reuseaddr',
- '--port=1234'
+ '--port=' + common.gitPort
],
{
cwd: pkg,
diff --git a/deps/npm/test/tap/add-remote-git-submodule.js b/deps/npm/test/tap/add-remote-git-submodule.js
index 6e26712c56..43b30f7a65 100644
--- a/deps/npm/test/tap/add-remote-git-submodule.js
+++ b/deps/npm/test/tap/add-remote-git-submodule.js
@@ -9,12 +9,12 @@ var test = require('tap').test
var npm = require('../../lib/npm.js')
var common = require('../common-tap.js')
-var pkg = resolve(__dirname, 'add-remote-git-submodule')
-var repos = resolve(__dirname, 'add-remote-git-submodule-repos')
+var pkg = common.pkg
+var repos = pkg + '-repos'
var subwt = resolve(repos, 'subwt')
var topwt = resolve(repos, 'topwt')
-var suburl = 'git://localhost:1234/sub.git'
-var topurl = 'git://localhost:1234/top.git'
+var suburl = 'git://localhost:' + common.gitPort + '/sub.git'
+var topurl = 'git://localhost:' + common.gitPort + '/top.git'
var daemon
var daemonPID
@@ -97,7 +97,7 @@ function setup (cb) {
'--export-all',
'--base-path=.',
'--reuseaddr',
- '--port=1234'
+ '--port=' + common.gitPort
],
{
cwd: repos,
diff --git a/deps/npm/test/tap/add-remote-git.js b/deps/npm/test/tap/add-remote-git.js
index 24abf33a77..44294924f1 100644
--- a/deps/npm/test/tap/add-remote-git.js
+++ b/deps/npm/test/tap/add-remote-git.js
@@ -9,8 +9,8 @@ var test = require('tap').test
var npm = require('../../lib/npm.js')
var common = require('../common-tap.js')
-var pkg = resolve(__dirname, 'add-remote-git')
-var repo = resolve(__dirname, 'add-remote-git-repo')
+var pkg = common.pkg
+var repo = pkg + '-repo'
var daemon
var daemonPID
@@ -20,7 +20,7 @@ var pjParent = JSON.stringify({
name: 'parent',
version: '1.2.3',
dependencies: {
- child: 'git://localhost:1234/child.git'
+ child: 'git://localhost:' + common.gitPort + '/child.git'
}
}, null, 2) + '\n'
@@ -61,6 +61,7 @@ test('clean', function (t) {
})
function bootstrap () {
+ cleanup()
mkdirp.sync(pkg)
fs.writeFileSync(resolve(pkg, 'package.json'), pjParent)
}
@@ -81,12 +82,12 @@ function setup (cb) {
'--export-all',
'--base-path=.',
'--reuseaddr',
- '--port=1234'
+ '--port=' + common.gitPort
],
{
cwd: pkg,
env: process.env,
- stdio: ['pipe', 'pipe', 'pipe']
+ stdio: ['pipe', 1, 'pipe']
}
)
d.stderr.on('data', childFinder)
diff --git a/deps/npm/test/tap/adduser-always-auth.js b/deps/npm/test/tap/adduser-always-auth.js
index d327e35a9e..26541eebbc 100644
--- a/deps/npm/test/tap/adduser-always-auth.js
+++ b/deps/npm/test/tap/adduser-always-auth.js
@@ -6,8 +6,8 @@ var mr = require('npm-registry-mock')
var test = require('tap').test
var common = require('../common-tap.js')
-var opts = {cwd: __dirname}
-var outfile = path.resolve(__dirname, '_npmrc')
+var opts = { cwd: common.pkg }
+var outfile = path.resolve(common.pkg, '_npmrc')
var responses = {
'Username': 'u\n',
'Password': 'p\n',
@@ -98,7 +98,7 @@ test('npm login --scope <scope> uses <scope>:registry as its URI', function (t)
],
opts,
function (err, code) {
- t.notOk(code, 'exited OK')
+ t.equal(code, 0, 'exited OK')
t.notOk(err, 'no error output')
var config = fs.readFileSync(outfile, 'utf8')
t.like(config, new RegExp(scope + ':registry=' + uri), 'scope:registry is set')
diff --git a/deps/npm/test/tap/adduser-legacy-auth.js b/deps/npm/test/tap/adduser-legacy-auth.js
index 49015878f7..e46901c2b9 100644
--- a/deps/npm/test/tap/adduser-legacy-auth.js
+++ b/deps/npm/test/tap/adduser-legacy-auth.js
@@ -7,8 +7,8 @@ var mr = require('npm-registry-mock')
var test = require('tap').test
var common = require('../common-tap.js')
-var opts = { cwd: __dirname }
-var pkg = path.resolve(__dirname, 'adduser-legacy-auth')
+var opts = { cwd: common.pkg }
+var pkg = common.pkg
var outfile = path.resolve(pkg, '_npmrc')
var contents = '_auth=' + Buffer.from('u:x').toString('base64') + '\n' +
@@ -42,6 +42,7 @@ function mocks (server) {
}
test('setup', function (t) {
+ rimraf.sync(pkg)
mkdirp(pkg, function (er) {
t.ifError(er, pkg + ' made successfully')
@@ -65,8 +66,8 @@ test('npm login', function (t) {
opts,
function (err, code, stdout, stderr) {
if (err) throw err
- t.is(code, 0, 'exited OK')
t.is(stderr, '', 'no error output')
+ t.is(code, 0, 'exited OK')
var config = fs.readFileSync(outfile, 'utf8')
t.like(config, /:always-auth=false/, 'always-auth is scoped and false (by default)')
s.close()
diff --git a/deps/npm/test/tap/adduser-oauth.js b/deps/npm/test/tap/adduser-oauth.js
index 04065048c4..241fef2a2e 100644
--- a/deps/npm/test/tap/adduser-oauth.js
+++ b/deps/npm/test/tap/adduser-oauth.js
@@ -7,8 +7,8 @@ var mr = require('npm-registry-mock')
var test = require('tap').test
var common = require('../common-tap.js')
-var opts = { cwd: __dirname }
-var pkg = path.resolve(__dirname, 'adduser-oauth')
+var opts = { cwd: common.pkg }
+var pkg = common.pkg
var fakeBrowser = path.resolve(pkg, '_script.sh')
var configfile = path.resolve(pkg, '_npmrc')
var outfile = path.resolve(pkg, '_outfile')
diff --git a/deps/npm/test/tap/adduser-saml.js b/deps/npm/test/tap/adduser-saml.js
index 530ebb52b3..17a1a9f7b3 100644
--- a/deps/npm/test/tap/adduser-saml.js
+++ b/deps/npm/test/tap/adduser-saml.js
@@ -7,8 +7,8 @@ var mr = require('npm-registry-mock')
var test = require('tap').test
var common = require('../common-tap.js')
-var opts = { cwd: __dirname }
-var pkg = path.resolve(__dirname, 'adduser-saml')
+var opts = { cwd: common.pkg }
+var pkg = common.pkg
var fakeBrowser = path.resolve(pkg, '_script.sh')
var configfile = path.resolve(pkg, '_npmrc')
var outfile = path.resolve(pkg, '_outfile')
diff --git a/deps/npm/test/tap/aliases.js b/deps/npm/test/tap/aliases.js
index 19f0b1293e..0a0a9dfd95 100644
--- a/deps/npm/test/tap/aliases.js
+++ b/deps/npm/test/tap/aliases.js
@@ -15,7 +15,7 @@ const { Dir, File } = Tacks
const readdirAsync = BB.promisify(fs.readdir)
const readFileAsync = BB.promisify(fs.readFile)
-const testDir = path.join(__dirname, path.basename(__filename, '.js'))
+const testDir = common.pkg
let server
test('setup', t => {
@@ -98,12 +98,12 @@ test('installs an npm: protocol alias package', t => {
bar: {
version: '1.2.3',
from: 'bar@npm:foo@1.2.3',
- resolved: 'http://localhost:1337/foo/-/foo-1.2.3.tgz'
+ resolved: 'http://localhost:' + common.port + '/foo/-/foo-1.2.3.tgz'
},
foo: {
version: '1.2.3',
from: 'foo@1.2.3',
- resolved: 'http://localhost:1337/foo/-/foo-1.2.3.tgz'
+ resolved: 'http://localhost:' + common.port + '/foo/-/foo-1.2.3.tgz'
}
}
}, 'both dependencies listed correctly')
@@ -149,12 +149,12 @@ test('installs an npm: protocol alias package', t => {
bar: {
version: '1.2.4',
from: 'bar@npm:foo@1.2.4',
- resolved: 'http://localhost:1337/foo/-/foo-1.2.4.tgz'
+ resolved: 'http://localhost:' + common.port + '/foo/-/foo-1.2.4.tgz'
},
foo: {
version: '1.2.4',
from: 'foo@1.2.4',
- resolved: 'http://localhost:1337/foo/-/foo-1.2.4.tgz'
+ resolved: 'http://localhost:' + common.port + '/foo/-/foo-1.2.4.tgz'
}
}
}, 'ls shows updated packages')
diff --git a/deps/npm/test/tap/all-package-metadata-cache-stream-unit.js b/deps/npm/test/tap/all-package-metadata-cache-stream-unit.js
index 0b4dd0e26d..9c1babd59c 100644
--- a/deps/npm/test/tap/all-package-metadata-cache-stream-unit.js
+++ b/deps/npm/test/tap/all-package-metadata-cache-stream-unit.js
@@ -1,6 +1,6 @@
'use strict'
-require('../common-tap.js')
+const common = require('../common-tap.js')
const getStream = require('get-stream')
const mkdirp = require('mkdirp')
@@ -13,7 +13,7 @@ const {File} = Tacks
const _createCacheEntryStream = require('../../lib/search/all-package-metadata.js')._createCacheEntryStream
-const PKG_DIR = path.resolve(__dirname, 'create-cache-entry-stream')
+const PKG_DIR = common.pkg
const CACHE_DIR = path.resolve(PKG_DIR, 'cache')
function setup () {
diff --git a/deps/npm/test/tap/all-package-metadata-entry-stream-unit.js b/deps/npm/test/tap/all-package-metadata-entry-stream-unit.js
index 4e916229cd..e693e6b33d 100644
--- a/deps/npm/test/tap/all-package-metadata-entry-stream-unit.js
+++ b/deps/npm/test/tap/all-package-metadata-entry-stream-unit.js
@@ -14,7 +14,7 @@ const {File} = Tacks
const _createEntryStream = require('../../lib/search/all-package-metadata.js')._createEntryStream
-const PKG_DIR = path.resolve(__dirname, 'create-entry-update-stream')
+const PKG_DIR = common.pkg
const CACHE_DIR = path.resolve(PKG_DIR, 'cache')
let server
diff --git a/deps/npm/test/tap/all-package-metadata-update-stream-unit.js b/deps/npm/test/tap/all-package-metadata-update-stream-unit.js
index 2c08ac347e..782bdf231c 100644
--- a/deps/npm/test/tap/all-package-metadata-update-stream-unit.js
+++ b/deps/npm/test/tap/all-package-metadata-update-stream-unit.js
@@ -11,7 +11,7 @@ const mr = require('npm-registry-mock')
var _createEntryUpdateStream = require('../../lib/search/all-package-metadata.js')._createEntryUpdateStream
-var PKG_DIR = path.resolve(__dirname, 'create-entry-update-stream')
+var PKG_DIR = common.pkg
var CACHE_DIR = path.resolve(PKG_DIR, 'cache')
var server
diff --git a/deps/npm/test/tap/all-package-metadata-write-stream-unit.js b/deps/npm/test/tap/all-package-metadata-write-stream-unit.js
index 94bb7413f1..b258b40dfe 100644
--- a/deps/npm/test/tap/all-package-metadata-write-stream-unit.js
+++ b/deps/npm/test/tap/all-package-metadata-write-stream-unit.js
@@ -12,7 +12,7 @@ const ms = require('mississippi')
const _createCacheWriteStream = require('../../lib/search/all-package-metadata.js')._createCacheWriteStream
-const PKG_DIR = path.resolve(__dirname, 'create-cache-write-stream')
+const PKG_DIR = common.pkg
const CACHE_DIR = path.resolve(PKG_DIR, 'cache')
function setup () {
diff --git a/deps/npm/test/tap/all-package-metadata.js b/deps/npm/test/tap/all-package-metadata.js
index 99d3fa26c5..ec605c3486 100644
--- a/deps/npm/test/tap/all-package-metadata.js
+++ b/deps/npm/test/tap/all-package-metadata.js
@@ -15,7 +15,7 @@ const File = Tacks.File
const allPackageMetadata = require('../../lib/search/all-package-metadata.js')
-const PKG_DIR = path.resolve(__dirname, path.basename(__filename, '.js'), 'update-index')
+const PKG_DIR = path.resolve(common.pkg, 'update-index')
const CACHE_DIR = path.resolve(PKG_DIR, 'cache', '_cacache')
let cacheBase
let cachePath
diff --git a/deps/npm/test/tap/anon-cli-metrics.js b/deps/npm/test/tap/anon-cli-metrics.js
index 100ca526cf..d021cf62bc 100644
--- a/deps/npm/test/tap/anon-cli-metrics.js
+++ b/deps/npm/test/tap/anon-cli-metrics.js
@@ -9,7 +9,7 @@ var File = Tacks.File
var Dir = Tacks.Dir
var common = require('../common-tap.js')
-var basedir = path.join(__dirname, path.basename(__filename, '.js'))
+var basedir = common.pkg
var testdir = path.join(basedir, 'testdir')
var cachedir = path.join(basedir, 'cache')
var globaldir = path.join(basedir, 'global')
diff --git a/deps/npm/test/tap/audit-fix.js b/deps/npm/test/tap/audit-fix.js
index 7e95568289..a832078ae9 100644
--- a/deps/npm/test/tap/audit-fix.js
+++ b/deps/npm/test/tap/audit-fix.js
@@ -13,7 +13,7 @@ const test = tap.test
const Dir = Tacks.Dir
const File = Tacks.File
-const testDir = path.join(__dirname, path.basename(__filename, '.js'))
+const testDir = common.pkg
const EXEC_OPTS = { cwd: testDir }
diff --git a/deps/npm/test/tap/audit.js b/deps/npm/test/tap/audit.js
index 3384579f77..631eedf276 100644
--- a/deps/npm/test/tap/audit.js
+++ b/deps/npm/test/tap/audit.js
@@ -12,21 +12,10 @@ const test = tap.test
const Dir = Tacks.Dir
const File = Tacks.File
-const testDir = path.join(__dirname, path.basename(__filename, '.js'))
+const testDir = common.pkg
const EXEC_OPTS = { cwd: testDir }
-tap.tearDown(function () {
- process.chdir(__dirname)
- try {
- rimraf.sync(testDir)
- } catch (e) {
- if (process.platform !== 'win32') {
- throw e
- }
- }
-})
-
function tmock (t) {
return mr({port: common.port}).then(s => {
t.tearDown(function () {
@@ -263,6 +252,209 @@ test('exits with non-zero exit code for vulnerabilities at the `audit-level` fla
})
})
+test('exits with zero exit code for vulnerabilities in devDependencies when running with production flag', t => {
+ const fixture = new Tacks(new Dir({
+ 'package.json': new File({
+ name: 'foo',
+ version: '1.0.0',
+ dependencies: {
+ gooddep: '1.0.0'
+ },
+ devDependencies: {
+ baddep: '1.0.0'
+ }
+ })
+ }))
+ fixture.create(testDir)
+ return tmock(t).then(srv => {
+ srv.filteringRequestBody(req => 'ok')
+ srv.post('/-/npm/v1/security/audits/quick', 'ok').reply(200, 'yeah')
+ srv.get('/gooddep').twice().reply(200, {
+ name: 'gooddep',
+ 'dist-tags': {
+ 'latest': '1.2.3'
+ },
+ versions: {
+ '1.0.0': {
+ name: 'gooddep',
+ version: '1.0.0',
+ _hasShrinkwrap: false,
+ dist: {
+ shasum: 'deadbeef',
+ tarball: common.registry + '/idk/-/idk-1.0.0.tgz'
+ }
+ },
+ '1.2.3': {
+ name: 'gooddep',
+ version: '1.2.3',
+ _hasShrinkwrap: false,
+ dist: {
+ shasum: 'deadbeef',
+ tarball: common.registry + '/idk/-/idk-1.2.3.tgz'
+ }
+ }
+ }
+ })
+ srv.get('/baddep').twice().reply(200, {
+ name: 'baddep',
+ 'dist-tags': {
+ 'latest': '1.2.3'
+ },
+ versions: {
+ '1.0.0': {
+ name: 'baddep',
+ version: '1.0.0',
+ _hasShrinkwrap: false,
+ dist: {
+ shasum: 'deadbeef',
+ tarball: common.registry + '/idk/-/idk-1.0.0.tgz'
+ }
+ },
+ '1.2.3': {
+ name: 'baddep',
+ version: '1.2.3',
+ _hasShrinkwrap: false,
+ dist: {
+ shasum: 'deadbeef',
+ tarball: common.registry + '/idk/-/idk-1.2.3.tgz'
+ }
+ }
+ }
+ })
+ return common.npm([
+ 'install',
+ '--audit',
+ '--json',
+ '--production',
+ '--package-lock-only',
+ '--registry', common.registry,
+ '--cache', path.join(testDir, 'npm-cache')
+ ], EXEC_OPTS).then(([code, stdout, stderr]) => {
+ srv.filteringRequestBody(req => 'ok')
+ srv.post('/-/npm/v1/security/audits', 'ok').reply(200, {
+ actions: [],
+ metadata: {
+ vulnerabilities: {}
+ }
+ })
+ return common.npm([
+ 'audit',
+ '--json',
+ '--production',
+ '--registry', common.registry,
+ '--cache', path.join(testDir, 'npm-cache')
+ ], EXEC_OPTS).then(([code, stdout, stderr]) => {
+ t.equal(code, 0, 'exited OK')
+ })
+ })
+ })
+})
+
+test('exits with non-zero exit code for vulnerabilities in dependencies when running with production flag', t => {
+ const fixture = new Tacks(new Dir({
+ 'package.json': new File({
+ name: 'foo',
+ version: '1.0.0',
+ dependencies: {
+ baddep: '1.0.0'
+ },
+ devDependencies: {
+ gooddep: '1.0.0'
+ }
+ })
+ }))
+ fixture.create(testDir)
+ return tmock(t).then(srv => {
+ srv.filteringRequestBody(req => 'ok')
+ srv.post('/-/npm/v1/security/audits/quick', 'ok').reply(200, 'yeah')
+ srv.get('/baddep').twice().reply(200, {
+ name: 'baddep',
+ 'dist-tags': {
+ 'latest': '1.2.3'
+ },
+ versions: {
+ '1.0.0': {
+ name: 'baddep',
+ version: '1.0.0',
+ _hasShrinkwrap: false,
+ dist: {
+ shasum: 'deadbeef',
+ tarball: common.registry + '/idk/-/idk-1.0.0.tgz'
+ }
+ },
+ '1.2.3': {
+ name: 'baddep',
+ version: '1.2.3',
+ _hasShrinkwrap: false,
+ dist: {
+ shasum: 'deadbeef',
+ tarball: common.registry + '/idk/-/idk-1.2.3.tgz'
+ }
+ }
+ }
+ })
+ srv.get('/gooddep').twice().reply(200, {
+ name: 'gooddep',
+ 'dist-tags': {
+ 'latest': '1.2.3'
+ },
+ versions: {
+ '1.0.0': {
+ name: 'gooddep',
+ version: '1.0.0',
+ _hasShrinkwrap: false,
+ dist: {
+ shasum: 'deadbeef',
+ tarball: common.registry + '/idk/-/idk-1.0.0.tgz'
+ }
+ },
+ '1.2.3': {
+ name: 'gooddep',
+ version: '1.2.3',
+ _hasShrinkwrap: false,
+ dist: {
+ shasum: 'deadbeef',
+ tarball: common.registry + '/idk/-/idk-1.2.3.tgz'
+ }
+ }
+ }
+ })
+ return common.npm([
+ 'install',
+ '--audit',
+ '--json',
+ '--production',
+ '--package-lock-only',
+ '--registry', common.registry,
+ '--cache', path.join(testDir, 'npm-cache')
+ ], EXEC_OPTS).then(([code, stdout, stderr]) => {
+ srv.filteringRequestBody(req => 'ok')
+ srv.post('/-/npm/v1/security/audits', 'ok').reply(200, {
+ actions: [{
+ action: 'update',
+ module: 'baddep',
+ target: '1.2.3',
+ resolves: [{path: 'baddep'}]
+ }],
+ metadata: {
+ vulnerabilities: {
+ low: 1
+ }
+ }
+ })
+ return common.npm([
+ 'audit',
+ '--json',
+ '--production',
+ '--registry', common.registry,
+ '--cache', path.join(testDir, 'npm-cache')
+ ], EXEC_OPTS).then(([code, stdout, stderr]) => {
+ t.equal(code, 1, 'exited OK')
+ })
+ })
+ })
+})
+
test('cleanup', t => {
return rimraf(testDir)
})
diff --git a/deps/npm/test/tap/auto-prune.js b/deps/npm/test/tap/auto-prune.js
index 3fa5d5d05b..8d129c4a83 100644
--- a/deps/npm/test/tap/auto-prune.js
+++ b/deps/npm/test/tap/auto-prune.js
@@ -7,7 +7,7 @@ const File = Tacks.File
const Dir = Tacks.Dir
const common = require('../common-tap.js')
-const basedir = path.join(__dirname, path.basename(__filename, '.js'))
+const basedir = common.pkg
const testdir = path.join(basedir, 'testdir')
const cachedir = path.join(basedir, 'cache')
const globaldir = path.join(basedir, 'global')
diff --git a/deps/npm/test/tap/bearer-token-check.js b/deps/npm/test/tap/bearer-token-check.js
index e3af793e60..21c6b0beb2 100644
--- a/deps/npm/test/tap/bearer-token-check.js
+++ b/deps/npm/test/tap/bearer-token-check.js
@@ -11,7 +11,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
var toNerfDart = require('../../lib/config/nerf-dart.js')
-var pkg = resolve(__dirname, 'install-bearer-check')
+var pkg = common.pkg
var outfile = resolve(pkg, '_npmrc')
var modules = resolve(pkg, 'node_modules')
var tarballPath = '/scoped-underscore/-/scoped-underscore-1.3.1.tgz'
diff --git a/deps/npm/test/tap/bin.js b/deps/npm/test/tap/bin.js
index 33320bc21f..bf2397777c 100644
--- a/deps/npm/test/tap/bin.js
+++ b/deps/npm/test/tap/bin.js
@@ -2,12 +2,12 @@ var path = require('path')
var test = require('tap').test
var rimraf = require('rimraf')
var common = require('../common-tap.js')
-var opts = { cwd: __dirname }
-var binDir = '../../node_modules/.bin'
-var fixture = path.resolve(__dirname, binDir)
+var opts = { cwd: common.pkg }
+var binDir = '../../../node_modules/.bin'
+var fixture = path.resolve(common.pkg, binDir)
test('setup', function (t) {
- rimraf.sync(path.join(__dirname, 'node_modules'))
+ rimraf.sync(path.join(common.pkg, 'node_modules'))
t.end()
})
diff --git a/deps/npm/test/tap/bitbucket-https-url-with-creds-package.js b/deps/npm/test/tap/bitbucket-https-url-with-creds-package.js
index ce65f15b28..4177d5f89f 100644
--- a/deps/npm/test/tap/bitbucket-https-url-with-creds-package.js
+++ b/deps/npm/test/tap/bitbucket-https-url-with-creds-package.js
@@ -13,7 +13,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'bitbucket-https-url-with-creds-package')
+var pkg = common.pkg
var json = {
name: 'bitbucket-https-url-with-creds-package',
diff --git a/deps/npm/test/tap/bitbucket-https-url-with-creds.js b/deps/npm/test/tap/bitbucket-https-url-with-creds.js
index ae87d85848..09f7e0e8e5 100644
--- a/deps/npm/test/tap/bitbucket-https-url-with-creds.js
+++ b/deps/npm/test/tap/bitbucket-https-url-with-creds.js
@@ -13,7 +13,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'bitbucket-https-url-with-creds')
+var pkg = common.pkg
var json = {
name: 'bitbucket-https-url-with-creds',
diff --git a/deps/npm/test/tap/bitbucket-shortcut-package.js b/deps/npm/test/tap/bitbucket-shortcut-package.js
index 8c418d37dc..bf1a39068e 100644
--- a/deps/npm/test/tap/bitbucket-shortcut-package.js
+++ b/deps/npm/test/tap/bitbucket-shortcut-package.js
@@ -13,7 +13,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'bitbucket-shortcut-package')
+var pkg = common.pkg
var json = {
name: 'bitbucket-shortcut-package',
diff --git a/deps/npm/test/tap/bitbucket-shortcut.js b/deps/npm/test/tap/bitbucket-shortcut.js
index f8167fdd2d..c81554e2d9 100644
--- a/deps/npm/test/tap/bitbucket-shortcut.js
+++ b/deps/npm/test/tap/bitbucket-shortcut.js
@@ -13,7 +13,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'bitbucket-shortcut')
+var pkg = common.pkg
var json = {
name: 'bitbucket-shortcut',
diff --git a/deps/npm/test/tap/bugs.js b/deps/npm/test/tap/bugs.js
index 4d2ee37e13..8e2685220d 100644
--- a/deps/npm/test/tap/bugs.js
+++ b/deps/npm/test/tap/bugs.js
@@ -8,15 +8,15 @@ var rimraf = require('rimraf')
var fs = require('fs')
var path = require('path')
var join = path.join
-var outFile = path.join(__dirname, '/_output')
+var outFile = path.join(common.pkg, '/_output')
-var opts = { cwd: __dirname }
+var opts = { cwd: common.pkg }
test('setup', function (t) {
var s = '#!/usr/bin/env bash\n' +
- 'echo "$@" > ' + JSON.stringify(__dirname) + '/_output\n'
- fs.writeFileSync(join(__dirname, '/_script.sh'), s, 'ascii')
- fs.chmodSync(join(__dirname, '/_script.sh'), '0755')
+ 'echo "$@" > ' + JSON.stringify(common.pkg) + '/_output\n'
+ fs.writeFileSync(join(common.pkg, '/_script.sh'), s, 'ascii')
+ fs.chmodSync(join(common.pkg, '/_script.sh'), '0755')
t.pass('made script')
t.end()
})
@@ -28,7 +28,7 @@ test('npm bugs underscore', function (t) {
'bugs', 'underscore',
'--registry=' + common.registry,
'--loglevel=silent',
- '--browser=' + join(__dirname, '/_script.sh')
+ '--browser=' + join(common.pkg, '/_script.sh')
],
opts,
function (err, code, stdout, stderr) {
@@ -52,7 +52,7 @@ test('npm bugs optimist - github (https://)', function (t) {
'bugs', 'optimist',
'--registry=' + common.registry,
'--loglevel=silent',
- '--browser=' + join(__dirname, '/_script.sh')
+ '--browser=' + join(common.pkg, '/_script.sh')
],
opts,
function (err, code, stdout, stderr) {
@@ -76,7 +76,7 @@ test('npm bugs npm-test-peer-deps - no repo', function (t) {
'bugs', 'npm-test-peer-deps',
'--registry=' + common.registry,
'--loglevel=silent',
- '--browser=' + join(__dirname, '/_script.sh')
+ '--browser=' + join(common.pkg, '/_script.sh')
],
opts,
function (err, code, stdout, stderr) {
@@ -100,7 +100,7 @@ test('npm bugs test-repo-url-http - non-github (http://)', function (t) {
'bugs', 'test-repo-url-http',
'--registry=' + common.registry,
'--loglevel=silent',
- '--browser=' + join(__dirname, '/_script.sh')
+ '--browser=' + join(common.pkg, '/_script.sh')
],
opts,
function (err, code, stdout, stderr) {
@@ -124,7 +124,7 @@ test('npm bugs test-repo-url-https - gitlab (https://)', function (t) {
'bugs', 'test-repo-url-https',
'--registry=' + common.registry,
'--loglevel=silent',
- '--browser=' + join(__dirname, '/_script.sh')
+ '--browser=' + join(common.pkg, '/_script.sh')
],
opts,
function (err, code, stdout, stderr) {
@@ -148,7 +148,7 @@ test('npm bugs test-repo-url-ssh - gitlab (ssh://)', function (t) {
'bugs', 'test-repo-url-ssh',
'--registry=' + common.registry,
'--loglevel=silent',
- '--browser=' + join(__dirname, '/_script.sh')
+ '--browser=' + join(common.pkg, '/_script.sh')
],
opts,
function (err, code, stdout, stderr) {
@@ -166,7 +166,7 @@ test('npm bugs test-repo-url-ssh - gitlab (ssh://)', function (t) {
})
test('cleanup', function (t) {
- fs.unlinkSync(join(__dirname, '/_script.sh'))
+ rimraf.sync(common.pkg)
t.pass('cleaned up')
t.end()
})
diff --git a/deps/npm/test/tap/build-already-built.js b/deps/npm/test/tap/build-already-built.js
index 8a66f66e69..1e7359a558 100644
--- a/deps/npm/test/tap/build-already-built.js
+++ b/deps/npm/test/tap/build-already-built.js
@@ -10,7 +10,8 @@ var requireInject = require('require-inject')
var npm = require('../../lib/npm.js')
-var PKG_DIR = path.resolve(__dirname, 'build-already-built')
+const common = require('../common-tap.js')
+var PKG_DIR = common.pkg
var fakePkg = 'foo'
test('setup', function (t) {
diff --git a/deps/npm/test/tap/builtin-config.js b/deps/npm/test/tap/builtin-config.js
index b960ed0383..dddd405651 100644
--- a/deps/npm/test/tap/builtin-config.js
+++ b/deps/npm/test/tap/builtin-config.js
@@ -10,7 +10,7 @@ var common = require('../common-tap.js')
var path = require('path')
var rimraf = require('rimraf')
var mkdirp = require('mkdirp')
-var folder = path.resolve(__dirname, 'builtin-config')
+var folder = common.pkg
var test = require('tap').test
var npm = path.resolve(__dirname, '../..')
var spawn = require('child_process').spawn
diff --git a/deps/npm/test/tap/bundled-dependencies-nonarray.js b/deps/npm/test/tap/bundled-dependencies-nonarray.js
index 924e1b27b6..fdc32c2883 100644
--- a/deps/npm/test/tap/bundled-dependencies-nonarray.js
+++ b/deps/npm/test/tap/bundled-dependencies-nonarray.js
@@ -9,7 +9,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var dir = path.resolve(__dirname, path.basename(__filename, '.js'))
+var dir = common.pkg
var pkg = path.resolve(dir, 'pkg-with-bundled')
var dep = path.resolve(dir, 'a-bundled-dep')
diff --git a/deps/npm/test/tap/bundled-dependencies.js b/deps/npm/test/tap/bundled-dependencies.js
index c6d67e3c50..6dbfa8cb08 100644
--- a/deps/npm/test/tap/bundled-dependencies.js
+++ b/deps/npm/test/tap/bundled-dependencies.js
@@ -6,7 +6,7 @@ var rimraf = require('rimraf')
var mkdirp = require('mkdirp')
var fs = require('graceful-fs')
var tar = require('tar')
-var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
+var basepath = common.pkg
var fixturepath = path.resolve(basepath, 'npm-test-bundled-deps')
var targetpath = path.resolve(basepath, 'target')
var Tacks = require('tacks')
diff --git a/deps/npm/test/tap/bundled-transitive-deps.js b/deps/npm/test/tap/bundled-transitive-deps.js
index fe59149062..d3f296ab16 100644
--- a/deps/npm/test/tap/bundled-transitive-deps.js
+++ b/deps/npm/test/tap/bundled-transitive-deps.js
@@ -9,7 +9,7 @@ var common = require('../common-tap.js')
var npm = require('../../lib/npm.js')
var tar = require('tar')
var mkdirp = require('mkdirp')
-var testdir = path.join(__dirname, path.basename(__filename, '.js'))
+var testdir = common.pkg
var packed = path.join(testdir, 'packed')
var fixture = new Tacks(
diff --git a/deps/npm/test/tap/cache-add-unpublished.js b/deps/npm/test/tap/cache-add-unpublished.js
index 0e8a9de8bf..08592a50de 100644
--- a/deps/npm/test/tap/cache-add-unpublished.js
+++ b/deps/npm/test/tap/cache-add-unpublished.js
@@ -11,7 +11,7 @@ test('cache add', function (t) {
'cache',
'add',
'superfoo',
- '--registry=http://localhost:1337/'
+ '--registry=http://localhost:' + common.port + '/'
],
{},
function (er, c, so, se) {
@@ -31,7 +31,7 @@ function setup (cb) {
res.statusCode = 404
res.end('{"error":"not_found"}\n')
})
- s.listen(1337, function () {
+ s.listen(common.port, function () {
cb(null, s)
})
}
diff --git a/deps/npm/test/tap/cache-shasum-fork.js b/deps/npm/test/tap/cache-shasum-fork.js
index 1e92d43756..3bc2a5d2a5 100644
--- a/deps/npm/test/tap/cache-shasum-fork.js
+++ b/deps/npm/test/tap/cache-shasum-fork.js
@@ -14,7 +14,7 @@ var common = require('../common-tap.js')
var forkPath = path.resolve(
__dirname, '..', 'fixtures', 'forked-underscore-1.5.1.tgz'
)
-var pkg = path.resolve(__dirname, 'cache-shasum-fork')
+var pkg = common.pkg
var cache = path.join(pkg, 'cache')
var server
diff --git a/deps/npm/test/tap/check-cpu-reqs.js b/deps/npm/test/tap/check-cpu-reqs.js
index 4d8c3dc655..0a36492430 100644
--- a/deps/npm/test/tap/check-cpu-reqs.js
+++ b/deps/npm/test/tap/check-cpu-reqs.js
@@ -7,7 +7,7 @@ var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
var common = require('../common-tap.js')
-var base = path.join(__dirname, path.basename(__filename, '.js'))
+var base = common.pkg
var installFrom = path.join(base, 'from')
var installIn = path.join(base, 'in')
diff --git a/deps/npm/test/tap/check-engine-reqs.js b/deps/npm/test/tap/check-engine-reqs.js
index 8dd9b8231f..7cbbcd354f 100644
--- a/deps/npm/test/tap/check-engine-reqs.js
+++ b/deps/npm/test/tap/check-engine-reqs.js
@@ -7,7 +7,7 @@ var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
var common = require('../common-tap.js')
-var base = path.join(__dirname, path.basename(__filename, '.js'))
+var base = common.pkg
var installFrom = path.join(base, 'from')
var installIn = path.join(base, 'in')
diff --git a/deps/npm/test/tap/check-install-self.js b/deps/npm/test/tap/check-install-self.js
index 2cde1606a9..e7591b55e0 100644
--- a/deps/npm/test/tap/check-install-self.js
+++ b/deps/npm/test/tap/check-install-self.js
@@ -7,7 +7,7 @@ var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
var common = require('../common-tap.js')
-var base = path.join(__dirname, path.basename(__filename, '.js'))
+var base = common.pkg
var installFrom = path.join(base, 'from')
var installIn = path.join(base, 'in')
diff --git a/deps/npm/test/tap/check-os-reqs.js b/deps/npm/test/tap/check-os-reqs.js
index 5d0c1ecf78..6c43fa61aa 100644
--- a/deps/npm/test/tap/check-os-reqs.js
+++ b/deps/npm/test/tap/check-os-reqs.js
@@ -7,7 +7,7 @@ var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
var common = require('../common-tap.js')
-var base = path.join(__dirname, path.basename(__filename, '.js'))
+var base = common.pkg
var installFrom = path.join(base, 'from')
var installIn = path.join(base, 'in')
diff --git a/deps/npm/test/tap/check-permissions.js b/deps/npm/test/tap/check-permissions.js
index 0a5f2e038a..74e49fb65f 100644
--- a/deps/npm/test/tap/check-permissions.js
+++ b/deps/npm/test/tap/check-permissions.js
@@ -8,7 +8,8 @@ var writableFallback = require('../../lib/install/writable.js').fsOpenImplementa
var exists = require('../../lib/install/exists.js').fsAccessImplementation
var existsFallback = require('../../lib/install/exists.js').fsStatImplementation
-var testBase = path.resolve(__dirname, 'check-permissions')
+const common = require('../common-tap.js')
+var testBase = common.pkg
var existingDir = path.resolve(testBase, 'exists')
var nonExistingDir = path.resolve(testBase, 'does-not-exist')
var writableDir = path.resolve(testBase, 'writable')
diff --git a/deps/npm/test/tap/ci-header.js b/deps/npm/test/tap/ci-header.js
index dc20cc53c3..530da3bf3a 100644
--- a/deps/npm/test/tap/ci-header.js
+++ b/deps/npm/test/tap/ci-header.js
@@ -8,7 +8,7 @@ var Dir = Tacks.Dir
var chain = require('slide').chain
var common = require('../common-tap.js')
-var basedir = path.join(__dirname, path.basename(__filename, '.js'))
+var basedir = common.pkg
var testdir = path.join(basedir, 'testdir')
var cachedir = path.join(basedir, 'cache')
var globaldir = path.join(basedir, 'global')
diff --git a/deps/npm/test/tap/ci.js b/deps/npm/test/tap/ci.js
index 9d69e3e5eb..9150f26efe 100644
--- a/deps/npm/test/tap/ci.js
+++ b/deps/npm/test/tap/ci.js
@@ -12,7 +12,7 @@ const test = require('tap').test
const Dir = Tacks.Dir
const File = Tacks.File
-const testDir = path.join(__dirname, 'ci')
+const testDir = common.pkg
const EXEC_OPTS = { cwd: testDir }
@@ -44,25 +44,27 @@ test('setup', () => {
const fixture = new Tacks(Dir({
'package.json': File(PKG)
}))
- fixture.create(testDir)
- return mr({port: common.port})
+ return rimraf(testDir).then(() => {
+ fixture.create(testDir)
+ return mr({port: common.port})
+ })
.then((server) => {
SERVER = server
return common.npm([
'install',
'--registry', common.registry
], EXEC_OPTS)
- .then(() => fs.readFileAsync(
- path.join(testDir, 'package-lock.json'),
- 'utf8')
- )
- .then((lock) => {
- RAW_LOCKFILE = lock
- })
- .then(() => common.npm(['ls', '--json'], EXEC_OPTS))
- .then((ret) => {
- TREE = scrubFrom(JSON.parse(ret[1]))
- })
+ })
+ .then(() => fs.readFileAsync(
+ path.join(testDir, 'package-lock.json'),
+ 'utf8')
+ )
+ .then((lock) => {
+ RAW_LOCKFILE = lock
+ })
+ .then(() => common.npm(['ls', '--json'], EXEC_OPTS))
+ .then((ret) => {
+ TREE = scrubFrom(JSON.parse(ret[1]))
})
})
diff --git a/deps/npm/test/tap/circular-dep.js b/deps/npm/test/tap/circular-dep.js
index d7f66eacef..a08c41bf4a 100644
--- a/deps/npm/test/tap/circular-dep.js
+++ b/deps/npm/test/tap/circular-dep.js
@@ -11,7 +11,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
var server
-var pkg = path.resolve(__dirname, 'circular-dep')
+var pkg = common.pkg
var minimist = path.join(pkg, 'minimist')
var EXEC_OPTS = {
diff --git a/deps/npm/test/tap/config-basic.js b/deps/npm/test/tap/config-basic.js
index 0483695cf5..a95e94db29 100644
--- a/deps/npm/test/tap/config-basic.js
+++ b/deps/npm/test/tap/config-basic.js
@@ -1,6 +1,6 @@
var test = require('tap').test
+var common = require('../common-config.js')
var npmconf = require('../../lib/config/core.js')
-var common = require('./00-config-setup.js')
var path = require('path')
var projectData = {
@@ -58,15 +58,7 @@ var expectSources = {
}
function isDeeplyDetails (t, aa, bb, msg, seen) {
- if (aa == null && bb == null) return t.pass(msg)
- if (typeof bb !== 'object') return t.is(aa, bb, msg)
- if (!seen) seen = []
- for (var kk in seen) if (seen[kk] === aa || seen[kk] === bb) return
- seen.push(aa, bb)
- t.is(Object.keys(aa).length, Object.keys(bb).length, msg + ': # of elements')
- Object.keys(bb).forEach(function (key) {
- isDeeplyDetails(t, aa[key], bb[key], msg + ' -> ' + key, seen)
- })
+ return t.same(aa, bb, msg)
}
test('no builtin', function (t) {
diff --git a/deps/npm/test/tap/config-builtin.js b/deps/npm/test/tap/config-builtin.js
index 885d099a1f..713522d6cc 100644
--- a/deps/npm/test/tap/config-builtin.js
+++ b/deps/npm/test/tap/config-builtin.js
@@ -1,6 +1,6 @@
var test = require('tap').test
var npmconf = require('../../lib/config/core.js')
-var common = require('./00-config-setup.js')
+var common = require('../common-config.js')
var path = require('path')
var ucData = common.ucData
diff --git a/deps/npm/test/tap/config-certfile.js b/deps/npm/test/tap/config-certfile.js
index 4b960672ad..904a8c0147 100644
--- a/deps/npm/test/tap/config-certfile.js
+++ b/deps/npm/test/tap/config-certfile.js
@@ -1,4 +1,4 @@
-require('./00-config-setup.js')
+require('../common-config.js')
var path = require('path')
var fs = require('fs')
diff --git a/deps/npm/test/tap/config-credentials.js b/deps/npm/test/tap/config-credentials.js
index f6f00ee0e6..d8f6770666 100644
--- a/deps/npm/test/tap/config-credentials.js
+++ b/deps/npm/test/tap/config-credentials.js
@@ -1,7 +1,7 @@
var test = require('tap').test
var npmconf = require('../../lib/config/core.js')
-var common = require('./00-config-setup.js')
+var common = require('../common-config.js')
var URI = 'https://registry.lvh.me:8661/'
diff --git a/deps/npm/test/tap/config-edit.js b/deps/npm/test/tap/config-edit.js
index 7d6eb2588d..a4f78a262c 100644
--- a/deps/npm/test/tap/config-edit.js
+++ b/deps/npm/test/tap/config-edit.js
@@ -6,7 +6,7 @@ var rimraf = require('rimraf')
var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'npm-global-edit')
+var pkg = common.pkg
var editorSrc = function () { /*
#!/usr/bin/env node
diff --git a/deps/npm/test/tap/config-envReplace.js b/deps/npm/test/tap/config-envReplace.js
index 0b4f628d67..f65609f050 100644
--- a/deps/npm/test/tap/config-envReplace.js
+++ b/deps/npm/test/tap/config-envReplace.js
@@ -8,7 +8,8 @@ const ini = require('ini')
const test = require('tap').test
const npmconf = require('../../lib/config/core.js')
-const packagePath = path.resolve(__dirname, 'config-envReplace')
+const common = require('../common-tap.js')
+const packagePath = common.pkg
const packageJsonFile = JSON.stringify({
name: 'config-envReplace'
diff --git a/deps/npm/test/tap/config-list.js b/deps/npm/test/tap/config-list.js
index 05402d4bbe..7559214a72 100644
--- a/deps/npm/test/tap/config-list.js
+++ b/deps/npm/test/tap/config-list.js
@@ -5,7 +5,7 @@ var rimraf = require('rimraf')
var mkdirp = require('mkdirp')
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'config-list')
+var pkg = common.pkg
var opts = { cwd: pkg, env: common.emptyEnv() }
var npmrc = path.resolve(pkg, '.npmrc')
var npmrcContents = `
diff --git a/deps/npm/test/tap/config-malformed.js b/deps/npm/test/tap/config-malformed.js
index 4f74ea5387..0d859e0034 100644
--- a/deps/npm/test/tap/config-malformed.js
+++ b/deps/npm/test/tap/config-malformed.js
@@ -1,7 +1,7 @@
var test = require('tap').test
var npmconf = require('../../lib/config/core.js')
-var common = require('./00-config-setup.js')
+var common = require('../common-config.js')
test('with malformed', function (t) {
npmconf.load({}, common.malformed, function (er, conf) {
diff --git a/deps/npm/test/tap/config-new-cafile.js b/deps/npm/test/tap/config-new-cafile.js
index 9cffb19008..bd5792f3e3 100644
--- a/deps/npm/test/tap/config-new-cafile.js
+++ b/deps/npm/test/tap/config-new-cafile.js
@@ -1,4 +1,4 @@
-require('./00-config-setup.js')
+const common = require('../common-tap.js')
var path = require('path')
var fs = require('graceful-fs')
@@ -8,8 +8,9 @@ var rimraf = require('rimraf')
var osenv = require('osenv')
var npmconf = require('../../lib/config/core.js')
-var dir = path.resolve(__dirname, 'config-new-cafile')
+var dir = common.pkg
var beep = path.resolve(dir, 'beep.pem')
+var npmrc = path.resolve(dir, 'npmrc')
test('setup', function (t) {
bootstrap()
@@ -18,7 +19,7 @@ test('setup', function (t) {
test('can set new cafile when old is gone', function (t) {
t.plan(5)
- npmconf.load(function (error, conf) {
+ npmconf.load({ userconfig: npmrc }, function (error, conf) {
npmconf.loaded = false
t.ifError(error)
conf.set('cafile', beep, 'user')
@@ -26,7 +27,7 @@ test('can set new cafile when old is gone', function (t) {
t.ifError(error)
t.equal(conf.get('cafile'), beep)
rimraf.sync(beep)
- npmconf.load(function (error, conf) {
+ npmconf.load({ userconfig: npmrc }, function (error, conf) {
if (error) {
throw error
}
@@ -47,6 +48,7 @@ test('cleanup', function (t) {
function bootstrap () {
mkdirp.sync(dir)
+ fs.writeFileSync(npmrc, '')
fs.writeFileSync(beep, '')
}
diff --git a/deps/npm/test/tap/config-private.js b/deps/npm/test/tap/config-private.js
index 91582921e6..e6bf9d2e83 100644
--- a/deps/npm/test/tap/config-private.js
+++ b/deps/npm/test/tap/config-private.js
@@ -5,7 +5,7 @@ var rimraf = require('rimraf')
var mkdirp = require('mkdirp')
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'config-private')
+var pkg = common.pkg
var opts = { cwd: pkg }
test('setup', function (t) {
diff --git a/deps/npm/test/tap/config-project.js b/deps/npm/test/tap/config-project.js
index b9e8b7ac04..0f7be913c0 100644
--- a/deps/npm/test/tap/config-project.js
+++ b/deps/npm/test/tap/config-project.js
@@ -3,7 +3,7 @@ var path = require('path')
var fix = path.resolve(__dirname, '..', 'fixtures', 'config')
var projectRc = path.resolve(fix, '.npmrc')
var npmconf = require('../../lib/config/core.js')
-var common = require('./00-config-setup.js')
+var common = require('../common-config.js')
var projectData = { just: 'testing' }
diff --git a/deps/npm/test/tap/config-save.js b/deps/npm/test/tap/config-save.js
index a7f85d6015..23dc7b5960 100644
--- a/deps/npm/test/tap/config-save.js
+++ b/deps/npm/test/tap/config-save.js
@@ -1,13 +1,15 @@
var fs = require('fs')
var ini = require('ini')
-var test = require('tap').test
+var t = require('tap')
+const test = t.test
+var common = require('../common-config.js')
+var commonTap = require('../common-tap.js')
var npmconf = require('../../lib/config/core.js')
-var common = require('./00-config-setup.js')
var expectConf = [
'globalconfig = ' + common.globalconfig,
'email = i@izs.me',
- 'env-thing = asdf',
+ 'env-thing = foo',
'init.author.name = Isaac Z. Schlueter',
'init.author.email = i@izs.me',
'init.author.url = http://blog.izs.me/',
@@ -32,7 +34,7 @@ var expectConf = [
var expectFile = [
'globalconfig = ' + common.globalconfig,
'email = i@izs.me',
- 'env-thing = asdf',
+ 'env-thing = foo',
'init.author.name = Isaac Z. Schlueter',
'init.author.email = i@izs.me',
'init.author.url = http://blog.izs.me/',
@@ -54,6 +56,10 @@ var expectFile = [
''
].join('\n')
+const userconfig = commonTap.pkg + '/userconfig'
+fs.writeFileSync(userconfig, fs.readFileSync(common.userconfig))
+process.env.npm_config_userconfig = userconfig
+
test('saving configs', function (t) {
npmconf.load(function (er, conf) {
if (er) throw er
diff --git a/deps/npm/test/tap/correct-mkdir.js b/deps/npm/test/tap/correct-mkdir.js
index 2c93f943ad..c69f8b00b5 100644
--- a/deps/npm/test/tap/correct-mkdir.js
+++ b/deps/npm/test/tap/correct-mkdir.js
@@ -1,9 +1,9 @@
/* eslint-disable camelcase */
var test = require('tap').test
var assert = require('assert')
-var path = require('path')
var requireInject = require('require-inject')
-var cache_dir = path.resolve(__dirname, 'correct-mkdir')
+const common = require('../common-tap.js')
+var cache_dir = common.pkg
test('correct-mkdir: no race conditions', function (t) {
var mock_fs = {}
diff --git a/deps/npm/test/tap/cruft-test.js b/deps/npm/test/tap/cruft-test.js
index 0cbcc6f56c..4f2ed6c0d0 100644
--- a/deps/npm/test/tap/cruft-test.js
+++ b/deps/npm/test/tap/cruft-test.js
@@ -6,7 +6,7 @@ var rimraf = require('rimraf')
var test = require('tap').test
var common = require('../common-tap.js')
-var base = path.join(__dirname, path.basename(__filename, '.js'))
+var base = common.pkg
var cruft = path.join(base, 'node_modules', 'cruuuft')
var pkg = {
name: 'example',
diff --git a/deps/npm/test/tap/debug-logs.js b/deps/npm/test/tap/debug-logs.js
index a699735263..0e951c4bb0 100644
--- a/deps/npm/test/tap/debug-logs.js
+++ b/deps/npm/test/tap/debug-logs.js
@@ -8,7 +8,7 @@ var File = Tacks.File
var Dir = Tacks.Dir
var common = require('../common-tap.js')
-var basedir = path.join(__dirname, path.basename(__filename, '.js'))
+var basedir = common.pkg
var testdir = path.join(basedir, 'testdir')
var cachedir = path.join(basedir, 'cache')
var globaldir = path.join(basedir, 'global')
@@ -66,16 +66,28 @@ test('example', function (t) {
t.matches(path.relative(cachedir, logfile), /^_logs/, 'debug log is inside the cache in _logs')
}
- // we run a bunch concurrently, this will actually create > than our limit as the check is done
- // when the command starts
- var todo = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
+ // we run a bunch concurrently, this will actually create > than our limit
+ // as the check is done when the command starts
+ //
+ // It has to be > the log count (10) but also significantly higher than
+ // the number of cores on the machine, or else some might be able to get
+ // to the log folder pruning logic in parallel, resulting in FEWER files
+ // than we expect being present at the end.
+ var procCount = Math.max(require('os').cpus().length * 2, 12)
+ var todo = new Array(procCount).join(',').split(',').map((v, k) => k)
asyncMap(todo, function (num, next) {
+ // another way would be to just simulate this?
+ // var f = path.join(cachedir, '_logs', num + '-debug.log')
+ // require('fs').writeFile(f, 'log ' + num, next)
common.npm(['run', '--logs-max=10', 'false'], conf, function (err, code) {
if (err) throw err
t.is(code, 1, 'run #' + num + ' errored as expected')
next()
})
}, function () {
+ var files = glob.sync(path.join(cachedir, '_logs', '*'))
+ t.ok(files.length > 10, 'there should be more than 10 log files')
+
// now we do one more and that should clean up the list
common.npm(['run', '--logs-max=10', 'false'], conf, function (err, code) {
if (err) throw err
diff --git a/deps/npm/test/tap/dedupe-git-semver.js b/deps/npm/test/tap/dedupe-git-semver.js
index 21e372e24b..35bb2c87d8 100644
--- a/deps/npm/test/tap/dedupe-git-semver.js
+++ b/deps/npm/test/tap/dedupe-git-semver.js
@@ -36,7 +36,8 @@ const npm = requireInject.installGlobally('../../lib/npm.js', {
}
})
-const basedir = path.join(__dirname, path.basename(__filename, '.js'))
+const common = require('../common-tap.js')
+const basedir = common.pkg
const testdir = path.join(basedir, 'testdir')
const cachedir = path.join(basedir, 'cache')
const tmpdir = path.join(basedir, 'tmp')
diff --git a/deps/npm/test/tap/dedupe-scoped.js b/deps/npm/test/tap/dedupe-scoped.js
index 9d5ff9ac4c..957f67e141 100644
--- a/deps/npm/test/tap/dedupe-scoped.js
+++ b/deps/npm/test/tap/dedupe-scoped.js
@@ -6,7 +6,7 @@ var rimraf = require('rimraf')
var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = join(__dirname, 'dedupe-scoped')
+var pkg = common.pkg
var modules = join(pkg, 'node_modules')
var EXEC_OPTS = { cwd: pkg }
diff --git a/deps/npm/test/tap/dedupe.js b/deps/npm/test/tap/dedupe.js
index b6c601cbad..109f816562 100644
--- a/deps/npm/test/tap/dedupe.js
+++ b/deps/npm/test/tap/dedupe.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
var server
-var pkg = path.join(__dirname, 'dedupe')
+var pkg = common.pkg
var EXEC_OPTS = { cwd: pkg }
diff --git a/deps/npm/test/tap/dist-tag.js b/deps/npm/test/tap/dist-tag.js
index 3631a598e9..0567964d35 100644
--- a/deps/npm/test/tap/dist-tag.js
+++ b/deps/npm/test/tap/dist-tag.js
@@ -7,7 +7,7 @@ var mr = require('npm-registry-mock')
var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'dist-tag')
+var pkg = common.pkg
var server
var scoped = {
diff --git a/deps/npm/test/tap/do-not-remove-other-bins.js b/deps/npm/test/tap/do-not-remove-other-bins.js
index 6fec728d43..4e6b0d27b2 100644
--- a/deps/npm/test/tap/do-not-remove-other-bins.js
+++ b/deps/npm/test/tap/do-not-remove-other-bins.js
@@ -9,7 +9,7 @@ var test = require('tap').test
var common = require('../common-tap')
-var base = path.resolve(__dirname, path.basename(__filename, '.js'))
+var base = common.pkg
var installPath = path.resolve(base, 'install')
var installBin = path.resolve(installPath, 'node_modules', '.bin')
var packageApath = path.resolve(base, 'packageA')
diff --git a/deps/npm/test/tap/doctor.js b/deps/npm/test/tap/doctor.js
index 26c74833e2..6ee0574696 100644
--- a/deps/npm/test/tap/doctor.js
+++ b/deps/npm/test/tap/doctor.js
@@ -13,7 +13,7 @@ const which = require('which')
const Dir = Tacks.Dir
const File = Tacks.File
-const ROOT = path.join(__dirname, path.basename(__filename, '.js'))
+const ROOT = common.pkg
const CACHE = path.join(ROOT, 'cache')
const TMP = path.join(ROOT, 'tmp')
const PREFIX = path.join(ROOT, 'global-prefix')
diff --git a/deps/npm/test/tap/extraneous-dep-cycle-ls-ok.js b/deps/npm/test/tap/extraneous-dep-cycle-ls-ok.js
index d483b3e22a..11f52209ed 100644
--- a/deps/npm/test/tap/extraneous-dep-cycle-ls-ok.js
+++ b/deps/npm/test/tap/extraneous-dep-cycle-ls-ok.js
@@ -8,7 +8,7 @@ var rimraf = require('rimraf')
var common = require('../common-tap')
-var pkg = path.resolve(__dirname, path.basename(__filename, '.js'))
+var pkg = common.pkg
var pathModA = path.join(pkg, 'node_modules', 'moduleA')
var pathModB = path.join(pkg, 'node_modules', 'moduleB')
diff --git a/deps/npm/test/tap/false-name.js b/deps/npm/test/tap/false-name.js
index 1e2a4d43dd..301be4fc8e 100644
--- a/deps/npm/test/tap/false-name.js
+++ b/deps/npm/test/tap/false-name.js
@@ -18,7 +18,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.join(__dirname, 'false-name')
+var pkg = common.pkg
var cache = path.join(pkg, 'cache')
var server
diff --git a/deps/npm/test/tap/fetch-package-metadata.js b/deps/npm/test/tap/fetch-package-metadata.js
index 2fc501369e..9a45fb57a9 100644
--- a/deps/npm/test/tap/fetch-package-metadata.js
+++ b/deps/npm/test/tap/fetch-package-metadata.js
@@ -11,7 +11,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
var npm = require('../../lib/npm.js')
-var pkg = path.resolve(__dirname, path.basename(__filename, '.js'))
+var pkg = common.pkg
function setup (cb) {
cleanup()
@@ -56,7 +56,7 @@ test('fetch-package-metadata provides resolved metadata', function (t) {
function thenVerifyMetadata (err, pkg) {
t.ifError(err, 'fetched metadata')
- t.equals(pkg._resolved, 'http://localhost:1337/test-package/-/test-package-0.0.0.tgz', '_resolved')
+ t.equals(pkg._resolved, 'http://localhost:' + common.port + '/test-package/-/test-package-0.0.0.tgz', '_resolved')
t.equals(pkg._integrity, 'sha1-sNMrbEXCWcV4uiADdisgUTG9+9E=', '_integrity')
server.close()
t.end()
diff --git a/deps/npm/test/tap/full-warning-messages.js b/deps/npm/test/tap/full-warning-messages.js
index c986695d67..945cf66a62 100644
--- a/deps/npm/test/tap/full-warning-messages.js
+++ b/deps/npm/test/tap/full-warning-messages.js
@@ -6,7 +6,7 @@ var rimraf = require('rimraf')
var fs = require('graceful-fs')
var common = require('../common-tap')
-var base = path.resolve(__dirname, path.basename(__filename, '.js'))
+var base = common.pkg
var modA = path.resolve(base, 'modA')
var modB = path.resolve(base, 'modB')
diff --git a/deps/npm/test/tap/gently-rm-cmdshims.js b/deps/npm/test/tap/gently-rm-cmdshims.js
index 304c6956bd..6726fe76d8 100644
--- a/deps/npm/test/tap/gently-rm-cmdshims.js
+++ b/deps/npm/test/tap/gently-rm-cmdshims.js
@@ -7,7 +7,8 @@ var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
var npm = require('../../lib/npm.js')
-var work = path.join(__dirname, path.basename(__filename, '.js'))
+const common = require('../common-tap.js')
+var work = common.pkg
var doremove = path.join(work, 'doremove')
var dontremove = path.join(work, 'dontremove')
var example_json = {
diff --git a/deps/npm/test/tap/gently-rm-linked-module.js b/deps/npm/test/tap/gently-rm-linked-module.js
index 877c683c9f..ab595e10c7 100644
--- a/deps/npm/test/tap/gently-rm-linked-module.js
+++ b/deps/npm/test/tap/gently-rm-linked-module.js
@@ -1,6 +1,5 @@
var common = require('../common-tap.js')
-var basename = require('path').basename
var resolve = require('path').resolve
var fs = require('graceful-fs')
var test = require('tap').test
@@ -11,7 +10,7 @@ var Dir = Tacks.Dir
var Symlink = Tacks.Symlink
var isWindows = require('../../lib/utils/is-windows.js')
-var base = resolve(__dirname, basename(__filename, '.js'))
+var base = common.pkg
var fixture = new Tacks(Dir({
'working-dir': Dir({
'node_modules': Dir({}) // so it doesn't try to install into npm's own node_modules
diff --git a/deps/npm/test/tap/gently-rm-overeager.js b/deps/npm/test/tap/gently-rm-overeager.js
index 7299b2c3f4..91a3768aff 100644
--- a/deps/npm/test/tap/gently-rm-overeager.js
+++ b/deps/npm/test/tap/gently-rm-overeager.js
@@ -6,7 +6,7 @@ var rimraf = require('rimraf')
var common = require('../common-tap.js')
-var testdir = path.join(__dirname, path.basename(__filename, '.js'))
+var testdir = common.pkg
var pkg = path.join(testdir, 'gently-rm-overeager')
var dep = path.join(testdir, 'test-whoops')
diff --git a/deps/npm/test/tap/gently-rm-symlinked-global-dir.js b/deps/npm/test/tap/gently-rm-symlinked-global-dir.js
index 8ac290091c..0a27dae5c5 100644
--- a/deps/npm/test/tap/gently-rm-symlinked-global-dir.js
+++ b/deps/npm/test/tap/gently-rm-symlinked-global-dir.js
@@ -7,10 +7,10 @@ var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
var isWindows = require('../../lib/utils/is-windows.js')
-var pkg = resolve(__dirname, 'gently-rm-linked')
-var dep = resolve(__dirname, 'test-linked')
-var glb = resolve(__dirname, 'test-global')
-var lnk = resolve(__dirname, 'test-global-link')
+var pkg = resolve(common.pkg, 'package')
+var dep = resolve(common.pkg, 'test-linked')
+var glb = resolve(common.pkg, 'test-global')
+var lnk = resolve(common.pkg, 'test-global-link')
var EXEC_OPTS = { cwd: pkg }
diff --git a/deps/npm/test/tap/gist-short-shortcut-package.js b/deps/npm/test/tap/gist-short-shortcut-package.js
index 4074995ee5..d7c70b16b0 100644
--- a/deps/npm/test/tap/gist-short-shortcut-package.js
+++ b/deps/npm/test/tap/gist-short-shortcut-package.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'gist-short-shortcut-package')
+var pkg = common.pkg
var json = {
name: 'gist-short-shortcut-package',
diff --git a/deps/npm/test/tap/gist-short-shortcut.js b/deps/npm/test/tap/gist-short-shortcut.js
index 875c30e036..04bf5bd42a 100644
--- a/deps/npm/test/tap/gist-short-shortcut.js
+++ b/deps/npm/test/tap/gist-short-shortcut.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'gist-short-shortcut')
+var pkg = common.pkg
var json = {
name: 'gist-short-shortcut',
diff --git a/deps/npm/test/tap/gist-shortcut-package.js b/deps/npm/test/tap/gist-shortcut-package.js
index dd6f41359e..9851e80b0e 100644
--- a/deps/npm/test/tap/gist-shortcut-package.js
+++ b/deps/npm/test/tap/gist-shortcut-package.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'gist-shortcut-package')
+var pkg = common.pkg
var json = {
name: 'gist-shortcut-package',
diff --git a/deps/npm/test/tap/gist-shortcut.js b/deps/npm/test/tap/gist-shortcut.js
index 8ad5ef001c..9958a996e0 100644
--- a/deps/npm/test/tap/gist-shortcut.js
+++ b/deps/npm/test/tap/gist-shortcut.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'gist-shortcut')
+var pkg = common.pkg
var json = {
name: 'gist-shortcut',
diff --git a/deps/npm/test/tap/git-dependency-install-link.js b/deps/npm/test/tap/git-dependency-install-link.js
index 1bf839f302..462df8973f 100644
--- a/deps/npm/test/tap/git-dependency-install-link.js
+++ b/deps/npm/test/tap/git-dependency-install-link.js
@@ -11,9 +11,9 @@ var mr = require('npm-registry-mock')
var npm = require('../../lib/npm.js')
var common = require('../common-tap.js')
-var pkg = resolve(__dirname, 'git-dependency-install-link')
-var repo = resolve(__dirname, 'git-dependency-install-link-repo')
-var prefix = resolve(__dirname, 'git-dependency-install-link-prefix')
+var pkg = common.pkg
+var repo = pkg + '-repo'
+var prefix = pkg + '-prefix'
var cache = resolve(pkg, 'cache')
var daemon
@@ -32,7 +32,7 @@ var pjParent = JSON.stringify({
name: 'parent',
version: '1.2.3',
dependencies: {
- 'child': 'git://localhost:1234/child.git'
+ 'child': 'git://localhost:' + common.gitPort + '/child.git'
}
}, null, 2) + '\n'
@@ -139,7 +139,7 @@ function setup (cb) {
'--export-all',
'--base-path=.',
'--reuseaddr',
- '--port=1234'
+ '--port=' + common.gitPort
],
{
cwd: pkg,
diff --git a/deps/npm/test/tap/git-npmignore.js b/deps/npm/test/tap/git-npmignore.js
index 19d014c3d9..42c1637b18 100644
--- a/deps/npm/test/tap/git-npmignore.js
+++ b/deps/npm/test/tap/git-npmignore.js
@@ -1,7 +1,6 @@
/* eslint-disable camelcase */
var child_process = require('child_process')
var readdir = require('graceful-fs').readdirSync
-var path = require('path')
var resolve = require('path').resolve
var rimraf = require('rimraf')
@@ -42,7 +41,7 @@ var fixture = new Tacks(Dir({
})
}))
-var testdir = resolve(__dirname, path.basename(__filename, '.js'))
+var testdir = common.pkg
var cachedir = resolve(testdir, 'cache')
var dep = resolve(testdir, 'deps', 'gitch')
var packname = 'gitch-1.0.0.tgz'
diff --git a/deps/npm/test/tap/git-prepare.js b/deps/npm/test/tap/git-prepare.js
index 1a61056b4b..9112828ce4 100644
--- a/deps/npm/test/tap/git-prepare.js
+++ b/deps/npm/test/tap/git-prepare.js
@@ -11,7 +11,7 @@ const mr = require('npm-registry-mock')
const npm = require('../../lib/npm.js')
const common = require('../common-tap.js')
-const testdir = path.resolve(__dirname, path.basename(__filename, '.js'))
+const testdir = common.pkg
const repo = path.join(testdir, 'repo')
const prefix = path.join(testdir, 'prefix')
const cache = path.join(testdir, 'cache')
@@ -37,7 +37,7 @@ const fixture = new Tacks(Dir({
name: 'parent',
version: '1.2.3',
dependencies: {
- 'child': 'git://localhost:1234/child.git'
+ 'child': 'git://localhost:' + common.gitPort + '/child.git'
}
})
}),
@@ -144,7 +144,7 @@ function setup (cb) {
'--export-all',
'--base-path=.',
'--reuseaddr',
- '--port=1234'
+ '--port=' + common.gitPort
],
{
cwd: repo,
diff --git a/deps/npm/test/tap/github-shortcut-package.js b/deps/npm/test/tap/github-shortcut-package.js
index 73385436b7..a084479e17 100644
--- a/deps/npm/test/tap/github-shortcut-package.js
+++ b/deps/npm/test/tap/github-shortcut-package.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'github-shortcut-package')
+var pkg = common.pkg
var json = {
name: 'github-shortcut-package',
diff --git a/deps/npm/test/tap/github-shortcut.js b/deps/npm/test/tap/github-shortcut.js
index 641d64f3b9..90f4655149 100644
--- a/deps/npm/test/tap/github-shortcut.js
+++ b/deps/npm/test/tap/github-shortcut.js
@@ -13,7 +13,7 @@ const test = require('tap').test
const common = require('../common-tap.js')
-const pkg = path.resolve(__dirname, 'github-shortcut')
+const pkg = common.pkg
const json = {
name: 'github-shortcut',
diff --git a/deps/npm/test/tap/gitlab-shortcut-package.js b/deps/npm/test/tap/gitlab-shortcut-package.js
index 1dd1ba99fb..54632f8370 100644
--- a/deps/npm/test/tap/gitlab-shortcut-package.js
+++ b/deps/npm/test/tap/gitlab-shortcut-package.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'gitlab-shortcut-package')
+var pkg = common.pkg
var json = {
name: 'gitlab-shortcut-package',
diff --git a/deps/npm/test/tap/gitlab-shortcut.js b/deps/npm/test/tap/gitlab-shortcut.js
index 6b2bfbc3ed..724178867a 100644
--- a/deps/npm/test/tap/gitlab-shortcut.js
+++ b/deps/npm/test/tap/gitlab-shortcut.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'gitlab-shortcut')
+var pkg = common.pkg
var json = {
name: 'gitlab-shortcut',
diff --git a/deps/npm/test/tap/graceful-restart.js b/deps/npm/test/tap/graceful-restart.js
index 56513fbf7e..740561bd79 100644
--- a/deps/npm/test/tap/graceful-restart.js
+++ b/deps/npm/test/tap/graceful-restart.js
@@ -8,7 +8,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = resolve(__dirname, 'graceful-restart')
+var pkg = common.pkg
var outGraceless = [
'prerestart',
diff --git a/deps/npm/test/tap/ignore-install-link.js b/deps/npm/test/tap/ignore-install-link.js
index 684c6a05b2..129df3c271 100644
--- a/deps/npm/test/tap/ignore-install-link.js
+++ b/deps/npm/test/tap/ignore-install-link.js
@@ -9,7 +9,7 @@ var fs = require('fs')
var rimraf = require('rimraf')
var mkdirp = require('mkdirp')
-var root = path.resolve(__dirname, 'ignore-install-link')
+var root = common.pkg
var pkg = path.resolve(root, 'pkg')
var dep = path.resolve(root, 'dep')
var target = path.resolve(pkg, 'node_modules', 'dep')
diff --git a/deps/npm/test/tap/ignore-scripts.js b/deps/npm/test/tap/ignore-scripts.js
index 785921d7eb..f5af4553c2 100644
--- a/deps/npm/test/tap/ignore-scripts.js
+++ b/deps/npm/test/tap/ignore-scripts.js
@@ -9,7 +9,7 @@ var common = require('../common-tap')
// ignore-scripts/package.json has scripts that always exit with non-zero error
// codes.
-var pkg = path.resolve(__dirname, 'ignore-scripts')
+var pkg = common.pkg
var gypfile = 'bad_binding_file\n'
var json = {
diff --git a/deps/npm/test/tap/init-interrupt.js b/deps/npm/test/tap/init-interrupt.js
index b0c7643ddf..114bb2bacb 100644
--- a/deps/npm/test/tap/init-interrupt.js
+++ b/deps/npm/test/tap/init-interrupt.js
@@ -2,7 +2,6 @@
// if 'npm init' is interrupted with ^C, don't report
// 'init written successfully'
var test = require('tap').test
-var path = require('path')
var osenv = require('osenv')
var rimraf = require('rimraf')
var npmlog = require('npmlog')
@@ -10,7 +9,8 @@ var requireInject = require('require-inject')
var npm = require('../../lib/npm.js')
-var PKG_DIR = path.resolve(__dirname, 'init-interrupt')
+const common = require('../common-tap.js')
+var PKG_DIR = common.pkg
test('setup', function (t) {
cleanup()
diff --git a/deps/npm/test/tap/install-at-locally.js b/deps/npm/test/tap/install-at-locally.js
index fa0190ceb3..705c2df119 100644
--- a/deps/npm/test/tap/install-at-locally.js
+++ b/deps/npm/test/tap/install-at-locally.js
@@ -8,7 +8,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.join(__dirname, 'install-at-locally')
+var pkg = common.pkg
var EXEC_OPTS = { cwd: pkg, stdio: [0, 1, 2] }
diff --git a/deps/npm/test/tap/install-at-sub-path-locally.js b/deps/npm/test/tap/install-at-sub-path-locally.js
index e16b75179e..08b64746af 100644
--- a/deps/npm/test/tap/install-at-sub-path-locally.js
+++ b/deps/npm/test/tap/install-at-sub-path-locally.js
@@ -8,7 +8,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.join(__dirname, 'install-at-sub-path-locally')
+var pkg = common.pkg
var EXEC_OPTS = { cwd: pkg, stdio: [0, 1, 2] }
diff --git a/deps/npm/test/tap/install-bad-dep-format.js b/deps/npm/test/tap/install-bad-dep-format.js
index 94c7d175fd..d01996f155 100644
--- a/deps/npm/test/tap/install-bad-dep-format.js
+++ b/deps/npm/test/tap/install-bad-dep-format.js
@@ -21,7 +21,7 @@ test('invalid url format returns appropriate error', function (t) {
setup(json)
common.npm(['install'], {}, function (err, code, stdout, stderr) {
t.ifError(err, 'install ran without error')
- t.equals(code, 1, 'inall exited with code 1')
+ t.equals(code, 1, 'install exited with code 1')
t.match(stderr,
/ERR.*Unsupported URL Type/,
'Error should report that invalid url-style formats are used')
@@ -43,12 +43,12 @@ function cleanup () {
process.chdir(osenv.tmpdir())
var pkgs = [json]
pkgs.forEach(function (json) {
- rimraf.sync(path.resolve(__dirname, json.name))
+ rimraf.sync(path.resolve(common.pkg, json.name))
})
}
function mkPkg (json) {
- var pkgPath = path.resolve(__dirname, json.name)
+ var pkgPath = path.resolve(common.pkg, json.name)
mkdirp.sync(pkgPath)
fs.writeFileSync(
path.join(pkgPath, 'package.json'),
diff --git a/deps/npm/test/tap/install-bad-man.js b/deps/npm/test/tap/install-bad-man.js
index 226d0b24fc..98c8e9a7e0 100644
--- a/deps/npm/test/tap/install-bad-man.js
+++ b/deps/npm/test/tap/install-bad-man.js
@@ -8,8 +8,8 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = resolve(__dirname, 'install-bad-man')
-var target = resolve(__dirname, 'install-bad-man-target')
+var pkg = common.pkg
+var target = pkg + '-target'
var EXEC_OPTS = {
cwd: target
diff --git a/deps/npm/test/tap/install-before.js b/deps/npm/test/tap/install-before.js
index c99b996c43..05a254a1ef 100644
--- a/deps/npm/test/tap/install-before.js
+++ b/deps/npm/test/tap/install-before.js
@@ -12,7 +12,7 @@ const { test } = require('tap')
const { Dir, File } = Tacks
-const testDir = path.join(__dirname, path.basename(__filename, '.js'))
+const testDir = common.pkg
let server
test('setup', t => {
diff --git a/deps/npm/test/tap/install-bin-null.js b/deps/npm/test/tap/install-bin-null.js
index f45528a75a..7a87a2e0bb 100644
--- a/deps/npm/test/tap/install-bin-null.js
+++ b/deps/npm/test/tap/install-bin-null.js
@@ -8,7 +8,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.join(__dirname, 'install-bin-null')
+var pkg = common.pkg
var EXEC_OPTS = { cwd: pkg }
diff --git a/deps/npm/test/tap/install-cli-only-development.js b/deps/npm/test/tap/install-cli-only-development.js
index ff9d05f547..a68c0f8aac 100644
--- a/deps/npm/test/tap/install-cli-only-development.js
+++ b/deps/npm/test/tap/install-cli-only-development.js
@@ -9,7 +9,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.join(__dirname, 'install-cli-development')
+var pkg = common.pkg
var EXEC_OPTS = { cwd: pkg }
diff --git a/deps/npm/test/tap/install-cli-only-production.js b/deps/npm/test/tap/install-cli-only-production.js
index 40328d7735..e43692d3d7 100644
--- a/deps/npm/test/tap/install-cli-only-production.js
+++ b/deps/npm/test/tap/install-cli-only-production.js
@@ -9,7 +9,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.join(__dirname, 'install-cli-only-production')
+var pkg = common.pkg
var EXEC_OPTS = { cwd: pkg }
diff --git a/deps/npm/test/tap/install-cli-only-shrinkwrap.js b/deps/npm/test/tap/install-cli-only-shrinkwrap.js
index aa731909d3..e3a4685d9c 100644
--- a/deps/npm/test/tap/install-cli-only-shrinkwrap.js
+++ b/deps/npm/test/tap/install-cli-only-shrinkwrap.js
@@ -9,7 +9,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.join(__dirname, path.basename(__filename, '.js'))
+var pkg = common.pkg
var EXEC_OPTS = { cwd: pkg }
diff --git a/deps/npm/test/tap/install-cli-production-nosave.js b/deps/npm/test/tap/install-cli-production-nosave.js
index cf69ad3fae..46b3460b72 100644
--- a/deps/npm/test/tap/install-cli-production-nosave.js
+++ b/deps/npm/test/tap/install-cli-production-nosave.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
var server
-var pkg = path.join(__dirname, 'install-cli-production-nosave')
+var pkg = common.pkg
var EXEC_OPTS = { cwd: pkg }
diff --git a/deps/npm/test/tap/install-cli-production.js b/deps/npm/test/tap/install-cli-production.js
index a1fdac6e88..4c88add92f 100644
--- a/deps/npm/test/tap/install-cli-production.js
+++ b/deps/npm/test/tap/install-cli-production.js
@@ -9,7 +9,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.join(__dirname, 'install-cli-production')
+var pkg = common.pkg
var EXEC_OPTS = { cwd: pkg }
diff --git a/deps/npm/test/tap/install-cli-unicode.js b/deps/npm/test/tap/install-cli-unicode.js
index 01a5f4a471..2691db96d0 100644
--- a/deps/npm/test/tap/install-cli-unicode.js
+++ b/deps/npm/test/tap/install-cli-unicode.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
var server
-var pkg = path.resolve(__dirname, 'install-cli-unicode')
+var pkg = common.pkg
function hasOnlyAscii (s) {
return /^[\000-\177]*$/.test(s)
diff --git a/deps/npm/test/tap/install-contributors-count.js b/deps/npm/test/tap/install-contributors-count.js
index 52fba0fd24..ead9250813 100644
--- a/deps/npm/test/tap/install-contributors-count.js
+++ b/deps/npm/test/tap/install-contributors-count.js
@@ -1,12 +1,11 @@
'use strict'
-var path = require('path')
var test = require('tap').test
var Tacks = require('tacks')
var Dir = Tacks.Dir
var File = Tacks.File
var common = require('../common-tap.js')
-var testdir = path.resolve(__dirname, path.basename(__filename, '.js'))
+var testdir = common.pkg
var fixture = new Tacks(Dir({
node_modules: Dir({
a: Dir({
diff --git a/deps/npm/test/tap/install-dep-classification.js b/deps/npm/test/tap/install-dep-classification.js
index 153a7f3927..3c65459d34 100644
--- a/deps/npm/test/tap/install-dep-classification.js
+++ b/deps/npm/test/tap/install-dep-classification.js
@@ -7,7 +7,7 @@ const Dir = Tacks.Dir
const common = require('../common-tap.js')
const fs = require('fs')
-const basedir = path.join(__dirname, path.basename(__filename, '.js'))
+const basedir = common.pkg
const testdir = path.join(basedir, 'testdir')
const cachedir = path.join(basedir, 'cache')
const globaldir = path.join(basedir, 'global')
diff --git a/deps/npm/test/tap/install-duplicate-deps-warning.js b/deps/npm/test/tap/install-duplicate-deps-warning.js
index 017a5cdfe1..2b10d8aa31 100644
--- a/deps/npm/test/tap/install-duplicate-deps-warning.js
+++ b/deps/npm/test/tap/install-duplicate-deps-warning.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
var npm = require('../../')
-var pkg = path.resolve(__dirname, path.basename(__filename, '.js'))
+var pkg = common.pkg
var json = {
dependencies: {
diff --git a/deps/npm/test/tap/install-from-local.js b/deps/npm/test/tap/install-from-local.js
index 3cac382a70..a3e63b359d 100644
--- a/deps/npm/test/tap/install-from-local.js
+++ b/deps/npm/test/tap/install-from-local.js
@@ -8,7 +8,7 @@ var test = require('tap').test
var common = require('../common-tap')
-var root = path.join(__dirname, 'install-from-local')
+var root = common.pkg
var pkg = path.join(root, 'package-with-local-paths')
var EXEC_OPTS = { cwd: pkg }
diff --git a/deps/npm/test/tap/install-into-likenamed-folder.js b/deps/npm/test/tap/install-into-likenamed-folder.js
index 187d5fbf11..c7bc86f3ba 100644
--- a/deps/npm/test/tap/install-into-likenamed-folder.js
+++ b/deps/npm/test/tap/install-into-likenamed-folder.js
@@ -6,7 +6,7 @@ var rimraf = require('rimraf')
var test = require('tap').test
var common = require('../common-tap.js')
-var base = path.join(__dirname, path.basename(__filename, '.js'))
+var base = common.pkg
var moduleDir = path.join(base, 'example-src')
var destDir = path.join(base, 'example')
var moduleJson = {
diff --git a/deps/npm/test/tap/install-link-scripts.js b/deps/npm/test/tap/install-link-scripts.js
index acc88b4b2c..bff4dd5ef0 100644
--- a/deps/npm/test/tap/install-link-scripts.js
+++ b/deps/npm/test/tap/install-link-scripts.js
@@ -8,7 +8,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.join(__dirname, 'install-link-scripts')
+var pkg = common.pkg
var tmp = path.join(pkg, 'tmp')
var dep = path.join(pkg, 'dep')
diff --git a/deps/npm/test/tap/install-local-dep-cycle.js b/deps/npm/test/tap/install-local-dep-cycle.js
index 1f76ad9598..a66f04bce4 100644
--- a/deps/npm/test/tap/install-local-dep-cycle.js
+++ b/deps/npm/test/tap/install-local-dep-cycle.js
@@ -6,7 +6,7 @@ var rimraf = require('rimraf')
var test = require('tap').test
var common = require('../common-tap.js')
-var base = path.join(__dirname, path.basename(__filename, '.js'))
+var base = common.pkg
var baseJSON = {
name: 'base',
diff --git a/deps/npm/test/tap/install-man.js b/deps/npm/test/tap/install-man.js
index d24819ca78..720b4c217b 100644
--- a/deps/npm/test/tap/install-man.js
+++ b/deps/npm/test/tap/install-man.js
@@ -8,8 +8,8 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = resolve(__dirname, 'install-man')
-var target = resolve(__dirname, 'install-man-target')
+var pkg = common.pkg
+var target = pkg + '-target'
common.pendIfWindows('man pages do not get installed on Windows')
diff --git a/deps/npm/test/tap/install-noargs-dev.js b/deps/npm/test/tap/install-noargs-dev.js
index ec9c7e3687..4716dc2243 100644
--- a/deps/npm/test/tap/install-noargs-dev.js
+++ b/deps/npm/test/tap/install-noargs-dev.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
var server
-var pkg = path.join(__dirname, 'install-noargs-dev')
+var pkg = common.pkg
var EXEC_OPTS = { cwd: pkg }
diff --git a/deps/npm/test/tap/install-package-json-order.js b/deps/npm/test/tap/install-package-json-order.js
index 93977c6c3d..ae000ff673 100644
--- a/deps/npm/test/tap/install-package-json-order.js
+++ b/deps/npm/test/tap/install-package-json-order.js
@@ -5,7 +5,8 @@ var mkdirp = require('mkdirp')
var spawn = require('child_process').spawn
var npm = require.resolve('../../bin/npm-cli.js')
var node = process.execPath
-var pkg = path.resolve(__dirname, 'install-package-json-order')
+const common = require('../common-tap.js')
+var pkg = common.pkg
var workdir = path.join(pkg, 'workdir')
var tmp = path.join(pkg, 'tmp')
var cache = path.join(pkg, 'cache')
diff --git a/deps/npm/test/tap/install-package-lock-only.js b/deps/npm/test/tap/install-package-lock-only.js
index 1610988851..6e98f27b30 100644
--- a/deps/npm/test/tap/install-package-lock-only.js
+++ b/deps/npm/test/tap/install-package-lock-only.js
@@ -8,7 +8,7 @@ var File = Tacks.File
var Dir = Tacks.Dir
var common = require('../common-tap.js')
-var basedir = path.join(__dirname, path.basename(__filename, '.js'))
+var basedir = common.pkg
var testdir = path.join(basedir, 'testdir')
var cachedir = path.join(basedir, 'cache')
var globaldir = path.join(basedir, 'global')
diff --git a/deps/npm/test/tap/install-parse-error.js b/deps/npm/test/tap/install-parse-error.js
index 1330195ead..1a72c336de 100644
--- a/deps/npm/test/tap/install-parse-error.js
+++ b/deps/npm/test/tap/install-parse-error.js
@@ -1,12 +1,11 @@
'use strict'
-var path = require('path')
var test = require('tap').test
var Tacks = require('tacks')
var File = Tacks.File
var Dir = Tacks.Dir
var common = require('../common-tap.js')
-var testdir = path.join(__dirname, path.basename(__filename, '.js'))
+var testdir = common.pkg
var fixture = new Tacks(Dir({
'package.json': File(
diff --git a/deps/npm/test/tap/install-property-conflicts.js b/deps/npm/test/tap/install-property-conflicts.js
index 8f293885ab..c8f58e139f 100644
--- a/deps/npm/test/tap/install-property-conflicts.js
+++ b/deps/npm/test/tap/install-property-conflicts.js
@@ -8,7 +8,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = resolve(__dirname, 'install-property-conflicts')
+var pkg = common.pkg
var target = resolve(pkg, '_target')
var EXEC_OPTS = {
diff --git a/deps/npm/test/tap/install-report-just-installed.js b/deps/npm/test/tap/install-report-just-installed.js
index 0a2cde2562..23b373b269 100644
--- a/deps/npm/test/tap/install-report-just-installed.js
+++ b/deps/npm/test/tap/install-report-just-installed.js
@@ -1,12 +1,11 @@
'use strict'
-var path = require('path')
var test = require('tap').test
var Tacks = require('tacks')
var Dir = Tacks.Dir
var File = Tacks.File
var common = require('../common-tap.js')
-var testdir = path.resolve(__dirname, path.basename(__filename, '.js'))
+var testdir = common.pkg
var fixture = new Tacks(Dir({
node_modules: Dir({
a: Dir({
diff --git a/deps/npm/test/tap/install-save-consistent-newlines.js b/deps/npm/test/tap/install-save-consistent-newlines.js
index 6250377445..acea57c987 100644
--- a/deps/npm/test/tap/install-save-consistent-newlines.js
+++ b/deps/npm/test/tap/install-save-consistent-newlines.js
@@ -11,7 +11,7 @@ const test = require('tap').test
const common = require('../common-tap.js')
-const pkg = path.join(__dirname, 'install-save-consistent-newlines')
+const pkg = common.pkg
const EXEC_OPTS = { cwd: pkg }
diff --git a/deps/npm/test/tap/install-save-exact.js b/deps/npm/test/tap/install-save-exact.js
index 14e32f0f84..3d57ead361 100644
--- a/deps/npm/test/tap/install-save-exact.js
+++ b/deps/npm/test/tap/install-save-exact.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
var server
-var pkg = path.join(__dirname, 'install-save-exact')
+var pkg = common.pkg
var EXEC_OPTS = { cwd: pkg }
diff --git a/deps/npm/test/tap/install-save-local.js b/deps/npm/test/tap/install-save-local.js
index 5965281bf2..8f4f5ecb00 100644
--- a/deps/npm/test/tap/install-save-local.js
+++ b/deps/npm/test/tap/install-save-local.js
@@ -8,7 +8,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var root = path.join(__dirname, 'install-save-local')
+var root = common.pkg
var pkg = path.join(root, 'package')
var EXEC_OPTS = { cwd: pkg }
diff --git a/deps/npm/test/tap/install-save-prefix.js b/deps/npm/test/tap/install-save-prefix.js
index b669c5fb7e..001e24d873 100644
--- a/deps/npm/test/tap/install-save-prefix.js
+++ b/deps/npm/test/tap/install-save-prefix.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
var server
-var pkg = path.join(__dirname, 'install-save-prefix')
+var pkg = common.pkg
var EXEC_OPTS = { cwd: pkg }
diff --git a/deps/npm/test/tap/install-scoped-already-installed.js b/deps/npm/test/tap/install-scoped-already-installed.js
index 58966b047c..707d82a443 100644
--- a/deps/npm/test/tap/install-scoped-already-installed.js
+++ b/deps/npm/test/tap/install-scoped-already-installed.js
@@ -9,7 +9,7 @@ var test = require('tap').test
var common = require('../common-tap')
-var root = path.join(__dirname, 'install-scoped-already-installed')
+var root = common.pkg
var pkg = path.join(root, 'package-with-scoped-paths')
var modules = path.join(pkg, 'node_modules')
diff --git a/deps/npm/test/tap/install-scoped-link.js b/deps/npm/test/tap/install-scoped-link.js
index 9171b8f46f..920e7e3d45 100644
--- a/deps/npm/test/tap/install-scoped-link.js
+++ b/deps/npm/test/tap/install-scoped-link.js
@@ -12,8 +12,8 @@ var escapeExecPath = require('../../lib/utils/escape-exec-path')
var common = require('../common-tap.js')
-var pkg = path.join(__dirname, 'install-scoped-link')
-var work = path.join(__dirname, 'install-scoped-link-TEST')
+var pkg = common.pkg
+var work = pkg + '-TEST'
var modules = path.join(work, 'node_modules')
var EXEC_OPTS = { cwd: work }
diff --git a/deps/npm/test/tap/install-scoped-with-bundled-dependency.js b/deps/npm/test/tap/install-scoped-with-bundled-dependency.js
index bd197ae036..76f440dc6c 100644
--- a/deps/npm/test/tap/install-scoped-with-bundled-dependency.js
+++ b/deps/npm/test/tap/install-scoped-with-bundled-dependency.js
@@ -6,7 +6,7 @@ var File = Tacks.File
var Dir = Tacks.Dir
var common = require('../common-tap.js')
-var basedir = path.join(__dirname, path.basename(__filename, '.js'))
+var basedir = common.pkg
var testdir = path.join(basedir, 'testdir')
var cachedir = path.join(basedir, 'cache')
var globaldir = path.join(basedir, 'global')
diff --git a/deps/npm/test/tap/install-scoped-with-peer-dependency.js b/deps/npm/test/tap/install-scoped-with-peer-dependency.js
index 7f60c73221..477a04a105 100644
--- a/deps/npm/test/tap/install-scoped-with-peer-dependency.js
+++ b/deps/npm/test/tap/install-scoped-with-peer-dependency.js
@@ -7,7 +7,7 @@ var rimraf = require('rimraf')
var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.join(__dirname, 'install-scoped-with-peer-dependency')
+var pkg = common.pkg
var local = path.join(pkg, 'package')
var EXEC_OPTS = { }
diff --git a/deps/npm/test/tap/install-shrinkwrapped-git.js b/deps/npm/test/tap/install-shrinkwrapped-git.js
index 7bbb4f6e5f..7e50aa713d 100644
--- a/deps/npm/test/tap/install-shrinkwrapped-git.js
+++ b/deps/npm/test/tap/install-shrinkwrapped-git.js
@@ -11,7 +11,7 @@ var npm = require('../../lib/npm')
var common = require('../common-tap')
var chain = require('slide').chain
-var mockPath = resolve(__dirname, 'install-shrinkwrapped')
+var mockPath = common.pkg
var parentPath = resolve(mockPath, 'parent')
var parentNodeModulesPath = path.join(parentPath, 'node_modules')
var outdatedNodeModulesPath = resolve(mockPath, 'node-modules-backup')
@@ -53,11 +53,11 @@ test('shrinkwrapped git dependency got updated', function (t) {
if (err) { throw err }
chain([
// Install & shrinkwrap child package's first commit
- [npm.commands.install, ['git://localhost:1234/child.git#' + refs[0]]],
+ [npm.commands.install, ['git://localhost:' + common.gitPort + '/child.git#' + refs[0]]],
// Backup node_modules with the first commit
[fs.rename, parentNodeModulesPath, outdatedNodeModulesPath],
// Install & shrinkwrap child package's latest commit
- [npm.commands.install, ['git://localhost:1234/child.git#' + refs[1].substr(0, 8)]],
+ [npm.commands.install, ['git://localhost:' + common.gitPort + '/child.git#' + refs[1].substr(0, 8)]],
// Restore node_modules with the first commit
[rimraf, parentNodeModulesPath],
[fs.rename, outdatedNodeModulesPath, parentNodeModulesPath],
@@ -68,15 +68,15 @@ test('shrinkwrapped git dependency got updated', function (t) {
t.similar(pkglock, {
dependencies: {
child: {
- version: `git://localhost:1234/child.git#${refs[1]}`,
- from: `git://localhost:1234/child.git#${refs[1].substr(0, 8)}`
+ version: `git://localhost:${common.gitPort}/child.git#${refs[1]}`,
+ from: `git://localhost:${common.gitPort}/child.git#${refs[1].substr(0, 8)}`
}
}
}, 'version and from fields are correct in git-based pkglock dep')
var childPackageJSON = require(path.join(parentNodeModulesPath, 'child', 'package.json'))
t.equal(
childPackageJSON._resolved,
- 'git://localhost:1234/child.git#' + refs[1],
+ 'git://localhost:' + common.gitPort + '/child.git#' + refs[1],
"Child package wasn't updated"
)
t.end()
@@ -153,7 +153,7 @@ function startGitDaemon (cb) {
'--export-all',
'--base-path=' + mockPath, // Path to the dir that contains child.git
'--reuseaddr',
- '--port=1234'
+ '--port=' + common.gitPort
],
{
cwd: parentPath,
diff --git a/deps/npm/test/tap/install-test-cli-without-package-lock.js b/deps/npm/test/tap/install-test-cli-without-package-lock.js
index ea3d75feb6..468277d74d 100644
--- a/deps/npm/test/tap/install-test-cli-without-package-lock.js
+++ b/deps/npm/test/tap/install-test-cli-without-package-lock.js
@@ -8,7 +8,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.join(__dirname, path.basename(__filename, '.js'))
+var pkg = common.pkg
var EXEC_OPTS = { cwd: pkg }
diff --git a/deps/npm/test/tap/install-windows-newlines.js b/deps/npm/test/tap/install-windows-newlines.js
index 1c69b204ad..b56c7645eb 100644
--- a/deps/npm/test/tap/install-windows-newlines.js
+++ b/deps/npm/test/tap/install-windows-newlines.js
@@ -8,7 +8,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.join(__dirname, 'install-windows-newlines')
+var pkg = common.pkg
var EXEC_OPTS = { cwd: pkg, stdio: [0, 1, 2] }
diff --git a/deps/npm/test/tap/install-with-dev-dep-duplicate.js b/deps/npm/test/tap/install-with-dev-dep-duplicate.js
index 2d31b8fad7..b3a5898763 100644
--- a/deps/npm/test/tap/install-with-dev-dep-duplicate.js
+++ b/deps/npm/test/tap/install-with-dev-dep-duplicate.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
var npm = require('../../')
-var pkg = path.resolve(__dirname, 'dev-dep-duplicate')
+var pkg = common.pkg
var json = {
author: 'Anders Janmyr',
diff --git a/deps/npm/test/tap/invalid-dep-version-filtering.js b/deps/npm/test/tap/invalid-dep-version-filtering.js
index 19ab5d209d..502610f231 100644
--- a/deps/npm/test/tap/invalid-dep-version-filtering.js
+++ b/deps/npm/test/tap/invalid-dep-version-filtering.js
@@ -7,7 +7,7 @@ var Tacks = require('tacks')
var File = Tacks.File
var Dir = Tacks.Dir
-var testdir = path.join(__dirname, path.basename(__filename, '.js'))
+var testdir = common.pkg
var cachedir = path.join(testdir, 'cache')
var fixture = new Tacks(Dir({
diff --git a/deps/npm/test/tap/it.js b/deps/npm/test/tap/it.js
index b0dddb8f91..9b716139a3 100644
--- a/deps/npm/test/tap/it.js
+++ b/deps/npm/test/tap/it.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var common = require('../common-tap')
-var pkg = join(__dirname, 'run-script')
+var pkg = common.pkg
var installed = join(pkg, 'node_modules', 'underscore', 'package.json')
var json = {
diff --git a/deps/npm/test/tap/legacy-ignore-nested-nm.js b/deps/npm/test/tap/legacy-ignore-nested-nm.js
index 095c41efa1..6a57b72b60 100644
--- a/deps/npm/test/tap/legacy-ignore-nested-nm.js
+++ b/deps/npm/test/tap/legacy-ignore-nested-nm.js
@@ -4,7 +4,7 @@ var common = require('../common-tap.js')
var path = require('path')
var rimraf = require('rimraf')
var mkdirp = require('mkdirp')
-var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
+var basepath = common.pkg
var fixturepath = path.resolve(basepath, 'npm-test-ignore-nested-nm')
var modulepath = path.resolve(basepath, 'node_modules')
var installedpath = path.resolve(modulepath, 'npm-test-ignore-nested-nm')
diff --git a/deps/npm/test/tap/legacy-missing-bindir.js b/deps/npm/test/tap/legacy-missing-bindir.js
index 2285f8d2a7..398ef0e7ac 100644
--- a/deps/npm/test/tap/legacy-missing-bindir.js
+++ b/deps/npm/test/tap/legacy-missing-bindir.js
@@ -5,7 +5,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
var rimraf = require('rimraf')
var mkdirp = require('mkdirp')
-var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
+var basepath = common.pkg
var fixturepath = path.resolve(basepath, 'npm-test-missing-bindir')
var modulepath = path.resolve(basepath, 'node_modules')
var installedpath = path.resolve(modulepath, 'npm-test-missing-bindir')
diff --git a/deps/npm/test/tap/legacy-no-auth-leak.js b/deps/npm/test/tap/legacy-no-auth-leak.js
index f837239250..ce1adaeca7 100644
--- a/deps/npm/test/tap/legacy-no-auth-leak.js
+++ b/deps/npm/test/tap/legacy-no-auth-leak.js
@@ -1,8 +1,7 @@
'use strict'
var test = require('tap').test
var common = require('../common-tap.js')
-var path = require('path')
-var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
+var basepath = common.pkg
var Tacks = require('tacks')
var File = Tacks.File
var Dir = Tacks.Dir
diff --git a/deps/npm/test/tap/legacy-platform-all.js b/deps/npm/test/tap/legacy-platform-all.js
index 2bfb19a457..01c7be7ec1 100644
--- a/deps/npm/test/tap/legacy-platform-all.js
+++ b/deps/npm/test/tap/legacy-platform-all.js
@@ -4,7 +4,7 @@ var common = require('../common-tap.js')
var path = require('path')
var rimraf = require('rimraf')
var mkdirp = require('mkdirp')
-var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
+var basepath = common.pkg
var fixturepath = path.resolve(basepath, 'npm-test-platform-all')
var modulepath = path.resolve(basepath, 'node_modules')
var Tacks = require('tacks')
@@ -33,6 +33,7 @@ var fixture = new Tacks(
],
cpu: [
'arm',
+ 'arm64',
'mips',
'ia32',
'x64',
diff --git a/deps/npm/test/tap/legacy-platform.js b/deps/npm/test/tap/legacy-platform.js
index 4e94148b21..619d2e4330 100644
--- a/deps/npm/test/tap/legacy-platform.js
+++ b/deps/npm/test/tap/legacy-platform.js
@@ -4,7 +4,7 @@ var common = require('../common-tap.js')
var path = require('path')
var rimraf = require('rimraf')
var mkdirp = require('mkdirp')
-var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
+var basepath = common.pkg
var fixturepath = path.resolve(basepath, 'npm-test-platform')
var modulepath = path.resolve(basepath, 'node_modules')
var Tacks = require('tacks')
diff --git a/deps/npm/test/tap/legacy-private.js b/deps/npm/test/tap/legacy-private.js
index 5e7817bf6a..44a1094cd0 100644
--- a/deps/npm/test/tap/legacy-private.js
+++ b/deps/npm/test/tap/legacy-private.js
@@ -4,7 +4,7 @@ var common = require('../common-tap.js')
var path = require('path')
var rimraf = require('rimraf')
var mkdirp = require('mkdirp')
-var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
+var basepath = common.pkg
var fixturepath = path.resolve(basepath, 'npm-test-private')
var modulepath = path.resolve(basepath, 'node_modules')
var Tacks = require('tacks')
diff --git a/deps/npm/test/tap/legacy-test-package.js b/deps/npm/test/tap/legacy-test-package.js
index d94666b43e..3c807e5049 100644
--- a/deps/npm/test/tap/legacy-test-package.js
+++ b/deps/npm/test/tap/legacy-test-package.js
@@ -4,7 +4,7 @@ var common = require('../common-tap.js')
var path = require('path')
var rimraf = require('rimraf')
var mkdirp = require('mkdirp')
-var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
+var basepath = common.pkg
var fixturepath = path.resolve(basepath, 'npm-test-test-package')
var modulepath = path.resolve(basepath, 'node_modules')
var installedpath = path.resolve(modulepath, 'npm-test-test-package')
diff --git a/deps/npm/test/tap/lifecycle-INIT_CWD.js b/deps/npm/test/tap/lifecycle-INIT_CWD.js
index eec5c266ee..e035cf86d4 100644
--- a/deps/npm/test/tap/lifecycle-INIT_CWD.js
+++ b/deps/npm/test/tap/lifecycle-INIT_CWD.js
@@ -8,7 +8,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'lifecycle-initcwd')
+var pkg = common.pkg
var subdir = path.resolve(pkg, 'subdir')
var json = {
diff --git a/deps/npm/test/tap/lifecycle-order.js b/deps/npm/test/tap/lifecycle-order.js
index 903e1945d1..8f2b2ba4a7 100644
--- a/deps/npm/test/tap/lifecycle-order.js
+++ b/deps/npm/test/tap/lifecycle-order.js
@@ -8,7 +8,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, path.basename(__filename, '.js'))
+var pkg = common.pkg
var json = {
name: 'lifecycle-order',
diff --git a/deps/npm/test/tap/link.js b/deps/npm/test/tap/link.js
index 88f3caed79..f0339194a2 100644
--- a/deps/npm/test/tap/link.js
+++ b/deps/npm/test/tap/link.js
@@ -8,11 +8,11 @@ var writeFileSync = require('fs').writeFileSync
var common = require('../common-tap.js')
-var link = path.join(__dirname, 'link')
-var linkScoped = path.join(__dirname, 'link-scoped')
-var linkInstall = path.join(__dirname, 'link-install')
+var link = path.join(common.pkg, 'link')
+var linkScoped = path.join(common.pkg, 'link-scoped')
+var linkInstall = path.join(common.pkg, 'link-install')
var linkInside = path.join(linkInstall, 'node_modules', 'inside')
-var linkRoot = path.join(__dirname, 'link-root')
+var linkRoot = path.join(common.pkg, 'link-root')
var config = 'prefix = ' + linkRoot
var configPath = path.join(link, '_npmrc')
diff --git a/deps/npm/test/tap/local-args-relative-to-cwd.js b/deps/npm/test/tap/local-args-relative-to-cwd.js
index 6c424bf67f..de95516e28 100644
--- a/deps/npm/test/tap/local-args-relative-to-cwd.js
+++ b/deps/npm/test/tap/local-args-relative-to-cwd.js
@@ -6,7 +6,7 @@ var Tacks = require('tacks')
var File = Tacks.File
var Dir = Tacks.Dir
var common = require('../common-tap.js')
-var testdir = path.join(__dirname, path.basename(__filename, '.js'))
+var testdir = common.pkg
var fixture = new Tacks(
Dir({
diff --git a/deps/npm/test/tap/locker.js b/deps/npm/test/tap/locker.js
index 8c548095f7..5ee64196fe 100644
--- a/deps/npm/test/tap/locker.js
+++ b/deps/npm/test/tap/locker.js
@@ -10,7 +10,8 @@ var locker = require('../../lib/utils/locker.js')
var lock = locker.lock
var unlock = locker.unlock
-var pkg = path.join(__dirname, '/locker')
+const common = require('../common-tap.js')
+var pkg = common.pkg
var cache = path.join(pkg, '/cache')
var tmp = path.join(pkg, '/tmp')
var nm = path.join(pkg, '/node_modules')
diff --git a/deps/npm/test/tap/lockfile-http-deps.js b/deps/npm/test/tap/lockfile-http-deps.js
index a614daf139..aaa47f5de6 100644
--- a/deps/npm/test/tap/lockfile-http-deps.js
+++ b/deps/npm/test/tap/lockfile-http-deps.js
@@ -8,7 +8,7 @@ var File = Tacks.File
var Dir = Tacks.Dir
var common = require('../common-tap.js')
-var basedir = path.join(__dirname, path.basename(__filename, '.js'))
+var basedir = common.pkg
var testdir = path.join(basedir, 'testdir')
var cachedir = path.join(basedir, 'cache')
var globaldir = path.join(basedir, 'global')
diff --git a/deps/npm/test/tap/logout-scoped.js b/deps/npm/test/tap/logout-scoped.js
index db99320478..114cc09da7 100644
--- a/deps/npm/test/tap/logout-scoped.js
+++ b/deps/npm/test/tap/logout-scoped.js
@@ -8,15 +8,14 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'logout')
+var pkg = common.pkg
var outfile = path.join(pkg, '_npmrc')
var opts = { cwd: pkg }
-var contents = function () { /*
-foo=boo
-@bar:registry=http://localhost:1337
-//localhost:1337/:_authToken=glarb
-*/ }.toString().split('\n').slice(1, -1).join('\n')
+var contents = `foo=boo
+@bar:registry=http://localhost:${common.port}
+//localhost:${common.port}/:_authToken=glarb
+`
function mocks (server) {
server.delete('/-/user/token/glarb')
diff --git a/deps/npm/test/tap/logout.js b/deps/npm/test/tap/logout.js
index d62cb4fffc..9218b4bf6f 100644
--- a/deps/npm/test/tap/logout.js
+++ b/deps/npm/test/tap/logout.js
@@ -8,14 +8,13 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'logout')
+var pkg = common.pkg
var outfile = path.join(pkg, '_npmrc')
var opts = { cwd: pkg }
-var contents = function () { /*
-foo=boo
-//localhost:1337/:_authToken=glarb
-*/ }.toString().split('\n').slice(1, -1).join('\n')
+var contents = `foo=boo
+//localhost:${common.port}/:_authToken=glarb
+`
function mocks (server) {
server.delete('/-/user/token/glarb')
diff --git a/deps/npm/test/tap/ls-depth-cli.js b/deps/npm/test/tap/ls-depth-cli.js
index 7fd4a467d6..6bb2f3cd12 100644
--- a/deps/npm/test/tap/ls-depth-cli.js
+++ b/deps/npm/test/tap/ls-depth-cli.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var common = require('../common-tap')
-var pkg = path.resolve(__dirname, 'ls-depth-cli')
+var pkg = common.pkg
var EXEC_OPTS = {
cwd: pkg,
@@ -117,7 +117,7 @@ test('npm ls --depth=0 --json', function (t) {
'dependencies': {
'test-package-with-one-dep': {
'version': '0.0.0',
- 'resolved': 'http://localhost:1337/test-package-with-one-dep/-/test-package-with-one-dep-0.0.0.tgz'
+ 'resolved': 'http://localhost:' + common.port + '/test-package-with-one-dep/-/test-package-with-one-dep-0.0.0.tgz'
}
}
})
@@ -141,11 +141,11 @@ test('npm ls --depth=Infinity --json', function (t) {
'dependencies': {
'test-package-with-one-dep': {
'version': '0.0.0',
- 'resolved': 'http://localhost:1337/test-package-with-one-dep/-/test-package-with-one-dep-0.0.0.tgz',
+ 'resolved': 'http://localhost:' + common.port + '/test-package-with-one-dep/-/test-package-with-one-dep-0.0.0.tgz',
'dependencies': {
'test-package': {
'version': '0.0.0',
- 'resolved': 'http://localhost:1337/test-package/-/test-package-0.0.0.tgz'
+ 'resolved': 'http://localhost:' + common.port + '/test-package/-/test-package-0.0.0.tgz'
}
}
}
diff --git a/deps/npm/test/tap/ls-depth-unmet.js b/deps/npm/test/tap/ls-depth-unmet.js
index 4fd6740d6a..7a2ed4dacc 100644
--- a/deps/npm/test/tap/ls-depth-unmet.js
+++ b/deps/npm/test/tap/ls-depth-unmet.js
@@ -9,7 +9,7 @@ var test = require('tap').test
var common = require('../common-tap')
-var pkg = path.resolve(__dirname, 'ls-depth-unmet')
+var pkg = common.pkg
var EXEC_OPTS = { cwd: pkg }
diff --git a/deps/npm/test/tap/ls-env.js b/deps/npm/test/tap/ls-env.js
index 29058d9245..e3fbece3b0 100644
--- a/deps/npm/test/tap/ls-env.js
+++ b/deps/npm/test/tap/ls-env.js
@@ -9,7 +9,7 @@ var test = require('tap').test
var common = require('../common-tap')
-var pkg = path.resolve(__dirname, 'ls-depth')
+var pkg = common.pkg
var EXEC_OPTS = { cwd: pkg }
diff --git a/deps/npm/test/tap/ls-l-depth-0.js b/deps/npm/test/tap/ls-l-depth-0.js
index e9c2374aad..8459bd5203 100644
--- a/deps/npm/test/tap/ls-l-depth-0.js
+++ b/deps/npm/test/tap/ls-l-depth-0.js
@@ -10,7 +10,7 @@ var tmpdir = require('osenv').tmpdir
var common = require('../common-tap.js')
-var pkg = resolve(__dirname, 'ls-l-depth-0')
+var pkg = common.pkg
var dep = resolve(pkg, 'deps', 'glock')
var modules = resolve(pkg, 'node_modules')
diff --git a/deps/npm/test/tap/ls-peer.js b/deps/npm/test/tap/ls-peer.js
index 826380932a..fd53d37be6 100644
--- a/deps/npm/test/tap/ls-peer.js
+++ b/deps/npm/test/tap/ls-peer.js
@@ -6,7 +6,7 @@ const File = Tacks.File
const Dir = Tacks.Dir
const common = require('../common-tap.js')
-const basedir = path.join(__dirname, path.basename(__filename, '.js'))
+const basedir = common.pkg
const testdir = path.join(basedir, 'testdir')
const cachedir = path.join(basedir, 'cache')
const globaldir = path.join(basedir, 'global')
diff --git a/deps/npm/test/tap/ls-production-and-dev.js b/deps/npm/test/tap/ls-production-and-dev.js
index 5fc0b776e3..a39e643786 100644
--- a/deps/npm/test/tap/ls-production-and-dev.js
+++ b/deps/npm/test/tap/ls-production-and-dev.js
@@ -9,7 +9,7 @@ var test = require('tap').test
var common = require('../common-tap')
-var pkg = path.resolve(__dirname, 'ls-depth')
+var pkg = common.pkg
var EXEC_OPTS = { cwd: pkg }
diff --git a/deps/npm/test/tap/ls-top-errors.js b/deps/npm/test/tap/ls-top-errors.js
index 69b8b299c8..79a466fb12 100644
--- a/deps/npm/test/tap/ls-top-errors.js
+++ b/deps/npm/test/tap/ls-top-errors.js
@@ -8,7 +8,7 @@ var rimraf = require('rimraf')
var common = require('../common-tap')
-var pkg = path.resolve(__dirname, path.basename(__filename, '.js'))
+var pkg = common.pkg
var pathModA = path.join(pkg, 'node_modules', 'moduleA')
var pathModB = path.join(pkg, 'node_modules', 'moduleB')
diff --git a/deps/npm/test/tap/ls.js b/deps/npm/test/tap/ls.js
index acec723afb..b3bdbc613c 100644
--- a/deps/npm/test/tap/ls.js
+++ b/deps/npm/test/tap/ls.js
@@ -3,7 +3,7 @@ var test = require('tap').test
var path = require('path')
var rimraf = require('rimraf')
var common = require('../common-tap.js')
-var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
+var basepath = common.pkg
var fixturepath = path.resolve(basepath, 'npm-test-files')
var pkgpath = path.resolve(fixturepath, 'npm-test-ls')
var Tacks = require('tacks')
diff --git a/deps/npm/test/tap/nested-extraneous.js b/deps/npm/test/tap/nested-extraneous.js
index 99d4bea5b9..1764a41c75 100644
--- a/deps/npm/test/tap/nested-extraneous.js
+++ b/deps/npm/test/tap/nested-extraneous.js
@@ -5,7 +5,7 @@ var fs = require('fs')
var rimraf = require('rimraf')
var path = require('path')
-var pkg = path.resolve(__dirname, 'nested-extraneous')
+var pkg = common.pkg
var pj = {
name: 'nested-extraneous',
version: '1.2.3'
diff --git a/deps/npm/test/tap/no-global-warns.js b/deps/npm/test/tap/no-global-warns.js
index 304cf5bf54..538ab8b359 100644
--- a/deps/npm/test/tap/no-global-warns.js
+++ b/deps/npm/test/tap/no-global-warns.js
@@ -7,7 +7,7 @@ var rimraf = require('rimraf')
var writeFileSync = require('fs').writeFileSync
var common = require('../common-tap.js')
-var base = path.join(__dirname, path.basename(__filename, '.js'))
+var base = common.pkg
var mockGlobal = path.join(base, 'global')
var toInstall = path.join(base, 'to-install')
diff --git a/deps/npm/test/tap/no-scan-full-global-dir.js b/deps/npm/test/tap/no-scan-full-global-dir.js
index 6a9349d54d..7856ff33f4 100644
--- a/deps/npm/test/tap/no-scan-full-global-dir.js
+++ b/deps/npm/test/tap/no-scan-full-global-dir.js
@@ -6,12 +6,17 @@ var requireInject = require('require-inject')
var osenv = require('osenv')
var npm = require('../../lib/npm.js')
+// XXX update this when rpt's realpath.js is extracted out
+var rptRealpath = require.resolve('read-package-tree/realpath.js')
+
+const common = require('../common-tap.js')
+const pkg = common.pkg
var packages = {
- test: {package: {name: 'test'}, path: __dirname, children: ['abc', 'def', 'ghi', 'jkl']},
- abc: {package: {name: 'abc'}, path: path.join(__dirname, 'node_modules', 'abc')},
- def: {package: {name: 'def'}, path: path.join(__dirname, 'node_modules', 'def')},
- ghi: {package: {name: 'ghi'}, path: path.join(__dirname, 'node_modules', 'ghi')},
- jkl: {package: {name: 'jkl'}, path: path.join(__dirname, 'node_modules', 'jkl')}
+ test: {package: {name: 'test'}, path: pkg, children: ['abc', 'def', 'ghi', 'jkl']},
+ abc: {package: {name: 'abc'}, path: path.join(pkg, 'node_modules', 'abc')},
+ def: {package: {name: 'def'}, path: path.join(pkg, 'node_modules', 'def')},
+ ghi: {package: {name: 'ghi'}, path: path.join(pkg, 'node_modules', 'ghi')},
+ jkl: {package: {name: 'jkl'}, path: path.join(pkg, 'node_modules', 'jkl')}
}
var dirs = {}
var files = {}
@@ -39,6 +44,8 @@ mockFs.realpath = function (dir, cb) {
return cb(null, dir)
}
+const mockRptRealpath = path => Promise.resolve(path)
+
test('setup', function (t) {
npm.load(function () {
t.pass('npm loaded')
@@ -52,7 +59,8 @@ test('installer', function (t) {
'fs': mockFs,
'readdir-scoped-modules': mockReaddir,
'read-package-json': mockReadPackageJson,
- 'mkdirp': function (path, cb) { cb() }
+ 'mkdirp': function (path, cb) { cb() },
+ [rptRealpath]: mockRptRealpath
})
var Installer = installer.Installer
@@ -67,7 +75,7 @@ test('installer', function (t) {
}
}
- var inst = new TestInstaller(__dirname, false, ['def', 'abc'])
+ var inst = new TestInstaller(pkg, false, ['def', 'abc'])
inst.loadCurrentTree(function () {
var kids = inst.currentTree.children.map(function (child) { return child.package.name })
t.isDeeply(kids, ['abc', 'def'])
@@ -81,7 +89,8 @@ test('uninstaller', function (t) {
'fs': mockFs,
'readdir-scoped-modules': mockReaddir,
'read-package-json': mockReadPackageJson,
- 'mkdirp': function (path, cb) { cb() }
+ 'mkdirp': function (path, cb) { cb() },
+ [rptRealpath]: mockRptRealpath
})
var Uninstaller = uninstaller.Uninstaller
@@ -92,7 +101,7 @@ test('uninstaller', function (t) {
}
}
- var uninst = new TestUninstaller(__dirname, false, ['ghi', 'jkl'])
+ var uninst = new TestUninstaller(pkg, false, ['ghi', 'jkl'])
uninst.loadCurrentTree(function () {
var kids = uninst.currentTree.children.map(function (child) { return child.package.name })
t.isDeeply(kids, ['ghi', 'jkl'])
diff --git a/deps/npm/test/tap/noargs-install-config-save.js b/deps/npm/test/tap/noargs-install-config-save.js
index 12ccf86804..cb1af408ab 100644
--- a/deps/npm/test/tap/noargs-install-config-save.js
+++ b/deps/npm/test/tap/noargs-install-config-save.js
@@ -1,14 +1,12 @@
var common = require('../common-tap.js')
var test = require('tap').test
-var path = require('path')
var fs = require('fs')
var rimraf = require('rimraf')
var mkdirp = require('mkdirp')
var mr = require('npm-registry-mock')
-var pkg = path.resolve(process.env.npm_config_tmp || '/tmp',
- 'noargs-install-config-save')
+var pkg = common.pkg
function writePackageJson () {
rimraf.sync(pkg)
@@ -73,6 +71,6 @@ test('updates the package.json (adds dependencies) with an argument', function (
})
test('cleanup', function (t) {
- rimraf.sync(pkg + '/cache')
+ rimraf.sync(pkg)
t.end()
})
diff --git a/deps/npm/test/tap/node-modules-path-munge.js b/deps/npm/test/tap/node-modules-path-munge.js
index fdca0393cc..fb116806c8 100644
--- a/deps/npm/test/tap/node-modules-path-munge.js
+++ b/deps/npm/test/tap/node-modules-path-munge.js
@@ -4,7 +4,7 @@ var fs = require('fs')
var rimraf = require('rimraf')
var mkdirp = require('mkdirp')
var path = require('path')
-var dir = path.join(__dirname, 'my_node_modules')
+var dir = path.join(common.pkg, 'my_node_modules')
var script = process.platform === 'win32' ? 'echo %PATH%' : 'echo $PATH'
t.test('setup', function (t) {
diff --git a/deps/npm/test/tap/npm-api-not-loaded-error.js b/deps/npm/test/tap/npm-api-not-loaded-error.js
index 48b71e5213..8bf2635038 100644
--- a/deps/npm/test/tap/npm-api-not-loaded-error.js
+++ b/deps/npm/test/tap/npm-api-not-loaded-error.js
@@ -1,8 +1,9 @@
var test = require('tap').test
+const common = require('../common-tap.js')
var npm = require('../..')
var path = require('path')
var rimraf = require('rimraf')
-var npmrc = path.join(__dirname, 'npmrc')
+var npmrc = path.join(common.pkg, 'npmrc')
var fs = require('fs')
test('setup', function (t) {
diff --git a/deps/npm/test/tap/onload.js b/deps/npm/test/tap/onload.js
index 8d2b6c743b..4750fa6f88 100644
--- a/deps/npm/test/tap/onload.js
+++ b/deps/npm/test/tap/onload.js
@@ -2,13 +2,13 @@ var path = require('path')
var test = require('tap').test
var rimraf = require('rimraf')
var common = require('../common-tap.js')
-var opts = { cwd: __dirname }
+var opts = { cwd: common.pkg }
var binDir = '../../node_modules/.bin'
var fixture = path.resolve(__dirname, binDir)
var onload = path.resolve(__dirname, '../fixtures/onload.js')
test('setup', function (t) {
- rimraf.sync(path.join(__dirname, 'node_modules'))
+ rimraf.sync(path.join(common.pkg, 'node_modules'))
t.end()
})
diff --git a/deps/npm/test/tap/optional-metadep-rollback-collision.js b/deps/npm/test/tap/optional-metadep-rollback-collision.js
index 1c05d1ba58..51cc6367dd 100644
--- a/deps/npm/test/tap/optional-metadep-rollback-collision.js
+++ b/deps/npm/test/tap/optional-metadep-rollback-collision.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'optional-metadep-rollback-collision')
+var pkg = common.pkg
var deps = path.resolve(pkg, 'deps')
var opdep = path.resolve(pkg, 'node_modules', 'opdep')
var cache = path.resolve(pkg, 'cache')
diff --git a/deps/npm/test/tap/outdated-color.js b/deps/npm/test/tap/outdated-color.js
index 3a81d05a82..11c967650f 100644
--- a/deps/npm/test/tap/outdated-color.js
+++ b/deps/npm/test/tap/outdated-color.js
@@ -8,7 +8,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'outdated-color')
+var pkg = common.pkg
var EXEC_OPTS = { cwd: pkg }
diff --git a/deps/npm/test/tap/outdated-depth.js b/deps/npm/test/tap/outdated-depth.js
index 91523405e8..5cf7c7edac 100644
--- a/deps/npm/test/tap/outdated-depth.js
+++ b/deps/npm/test/tap/outdated-depth.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var npm = require('../../')
var common = require('../common-tap')
-var pkg = path.resolve(__dirname, 'outdated-depth')
+var pkg = common.pkg
var json = {
name: 'outdated-depth',
diff --git a/deps/npm/test/tap/outdated-git.js b/deps/npm/test/tap/outdated-git.js
index 2a595e5288..3932330c99 100644
--- a/deps/npm/test/tap/outdated-git.js
+++ b/deps/npm/test/tap/outdated-git.js
@@ -9,7 +9,7 @@ var common = require('../common-tap.js')
var npm = require('../../')
// config
-var pkg = path.resolve(__dirname, 'outdated-git')
+var pkg = common.pkg
var cache = path.resolve(pkg, 'cache')
var json = {
name: 'outdated-git',
diff --git a/deps/npm/test/tap/outdated-json.js b/deps/npm/test/tap/outdated-json.js
index 39d54fb196..77db52cc72 100644
--- a/deps/npm/test/tap/outdated-json.js
+++ b/deps/npm/test/tap/outdated-json.js
@@ -1,16 +1,13 @@
var fs = require('graceful-fs')
var path = require('path')
-var mkdirp = require('mkdirp')
var mr = require('npm-registry-mock')
-var osenv = require('osenv')
-var rimraf = require('rimraf')
var test = require('tap').test
var common = require('../common-tap.js')
var server
-var pkg = path.resolve(__dirname, 'outdated-json')
+var pkg = common.pkg
var EXEC_OPTS = { cwd: pkg }
@@ -42,8 +39,6 @@ var expected = {
}
test('setup', function (t) {
- cleanup()
- mkdirp.sync(pkg)
fs.writeFileSync(
path.join(pkg, 'package.json'),
JSON.stringify(json, null, 2)
@@ -92,14 +87,37 @@ test('it should log json data', function (t) {
)
})
+test('it should log json data even when the list is empty', function (t) {
+ common.npm(
+ [
+ 'rm',
+ 'request',
+ 'underscore'
+ ],
+ EXEC_OPTS,
+ function (er, code, stdout) {
+ t.ifError(er, 'run without error')
+ t.is(code, 0, 'successful exit status')
+ common.npm(
+ [
+ '--registry', common.registry,
+ '--silent',
+ '--json',
+ 'outdated'
+ ],
+ EXEC_OPTS,
+ function (er, code, stdout) {
+ t.ifError(er, 'run without error')
+ t.is(code, 0, 'successful exit status')
+ t.same(JSON.parse(stdout), {}, 'got an empty object printed')
+ t.end()
+ }
+ )
+ }
+ )
+})
+
test('cleanup', function (t) {
server.close()
- cleanup()
t.end()
})
-
-function cleanup () {
- // windows fix for locked files
- process.chdir(osenv.tmpdir())
- rimraf.sync(pkg)
-}
diff --git a/deps/npm/test/tap/outdated-latest.js b/deps/npm/test/tap/outdated-latest.js
index d72fd87176..e0b432a210 100644
--- a/deps/npm/test/tap/outdated-latest.js
+++ b/deps/npm/test/tap/outdated-latest.js
@@ -7,7 +7,7 @@ const File = Tacks.File
const Dir = Tacks.Dir
const common = require('../common-tap.js')
-const basedir = path.join(__dirname, path.basename(__filename, '.js'))
+const basedir = common.pkg
const testdir = path.join(basedir, 'testdir')
const cachedir = path.join(basedir, 'cache')
const globaldir = path.join(basedir, 'global')
diff --git a/deps/npm/test/tap/outdated-long.js b/deps/npm/test/tap/outdated-long.js
index 976d416a13..474df8031a 100644
--- a/deps/npm/test/tap/outdated-long.js
+++ b/deps/npm/test/tap/outdated-long.js
@@ -10,7 +10,7 @@ var common = require('../common-tap.js')
var npm = require('../../')
// config
-var pkg = path.resolve(__dirname, 'outdated-long')
+var pkg = common.pkg
var cache = path.resolve(pkg, 'cache')
var json = {
diff --git a/deps/npm/test/tap/outdated-remote.js b/deps/npm/test/tap/outdated-remote.js
new file mode 100644
index 0000000000..b3990a382c
--- /dev/null
+++ b/deps/npm/test/tap/outdated-remote.js
@@ -0,0 +1,95 @@
+'use strict'
+const path = require('path')
+const test = require('tap').test
+const Tacks = require('tacks')
+const File = Tacks.File
+const Dir = Tacks.Dir
+const common = require('../common-tap.js')
+
+const basedir = common.pkg
+const testdir = path.join(basedir, 'testdir')
+const cachedir = path.join(basedir, 'cache')
+const globaldir = path.join(basedir, 'global')
+const tmpdir = path.join(basedir, 'tmp')
+
+const conf = {
+ cwd: testdir,
+ env: common.newEnv().extend({
+ npm_config_cache: cachedir,
+ npm_config_tmp: tmpdir,
+ npm_config_prefix: globaldir,
+ npm_config_registry: common.registry,
+ npm_config_loglevel: 'warn'
+ })
+}
+
+const fixture = new Tacks(Dir({
+ cache: Dir(),
+ global: Dir(),
+ tmp: Dir(),
+ testdir: Dir({
+ node_modules: Dir({
+ 'foo-http': Dir({
+ 'package.json': File({
+ name: 'foo-http',
+ version: '1.0.0'
+ })
+ }),
+ 'foo-https': Dir({
+ 'package.json': File({
+ name: 'foo-https',
+ version: '1.0.0'
+ })
+ })
+ }),
+ 'package.json': File({
+ name: 'outdated-remote',
+ version: '1.0.0',
+ dependencies: {
+ 'foo-http': 'http://example.com/foo.tar.gz',
+ 'foo-https': 'https://example.com/foo.tar.gz'
+ }
+ })
+ })
+}))
+
+function setup () {
+ cleanup()
+ fixture.create(basedir)
+}
+
+function cleanup () {
+ fixture.remove(basedir)
+}
+
+test('setup', t => {
+ setup()
+ return common.fakeRegistry.listen()
+})
+
+test('discovers new versions in outdated', t => {
+ return common.npm(['outdated', '--json'], conf).then(([code, stdout, stderr]) => {
+ t.is(code, 1, 'npm outdated completed successfully')
+ t.comment(stdout.trim())
+ t.comment(stderr.trim())
+ const data = JSON.parse(stdout)
+ t.same(data['foo-http'], {
+ current: '1.0.0',
+ wanted: 'remote',
+ latest: 'remote',
+ location: ''
+ })
+ t.same(data['foo-https'], {
+ current: '1.0.0',
+ wanted: 'remote',
+ latest: 'remote',
+ location: ''
+ })
+ })
+})
+
+test('cleanup', t => {
+ common.fakeRegistry.close()
+ cleanup()
+ t.done()
+})
diff --git a/deps/npm/test/tap/outdated-symlink.js b/deps/npm/test/tap/outdated-symlink.js
index 96d6f660e2..86128338a7 100644
--- a/deps/npm/test/tap/outdated-symlink.js
+++ b/deps/npm/test/tap/outdated-symlink.js
@@ -8,7 +8,7 @@ const Symlink = Tacks.Symlink
const Dir = Tacks.Dir
const common = require('../common-tap.js')
-const basedir = path.join(__dirname, path.basename(__filename, '.js'))
+const basedir = common.pkg
const testdir = path.join(basedir, 'testdir')
const cachedir = path.join(basedir, 'cache')
const globaldir = path.join(basedir, 'global')
diff --git a/deps/npm/test/tap/outdated.js b/deps/npm/test/tap/outdated.js
index 8b1907d95f..1acb0ed687 100644
--- a/deps/npm/test/tap/outdated.js
+++ b/deps/npm/test/tap/outdated.js
@@ -10,7 +10,7 @@ var npm = require('../../')
var common = require('../common-tap.js')
// config
-var pkg = path.resolve(__dirname, 'outdated')
+var pkg = common.pkg
var cache = path.resolve(pkg, 'cache')
var originalLog
diff --git a/deps/npm/test/tap/override-bundled.js b/deps/npm/test/tap/override-bundled.js
index 493ebf4a5d..7f87c0999f 100644
--- a/deps/npm/test/tap/override-bundled.js
+++ b/deps/npm/test/tap/override-bundled.js
@@ -8,7 +8,7 @@ var path = require('path')
var common = require('../common-tap.js')
var testname = path.basename(__filename, '.js')
-var testdir = path.resolve(__dirname, testname)
+var testdir = common.pkg
var testmod = path.resolve(testdir, 'top-test')
var testtgz = testmod + '-1.0.0.tgz'
diff --git a/deps/npm/test/tap/owner.js b/deps/npm/test/tap/owner.js
index 0be88284d9..b4da383ee1 100644
--- a/deps/npm/test/tap/owner.js
+++ b/deps/npm/test/tap/owner.js
@@ -5,7 +5,7 @@ var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
var common = require('../common-tap.js')
-var basedir = path.join(__dirname, path.basename(__filename, '.js'))
+var basedir = common.pkg
var cachedir = path.join(basedir, 'cache')
var server
diff --git a/deps/npm/test/tap/pack-files-and-ignores.js b/deps/npm/test/tap/pack-files-and-ignores.js
index 3bcb22c7fc..4d9b97a32a 100644
--- a/deps/npm/test/tap/pack-files-and-ignores.js
+++ b/deps/npm/test/tap/pack-files-and-ignores.js
@@ -6,7 +6,7 @@ var rimraf = require('rimraf')
var mkdirp = require('mkdirp')
var fs = require('graceful-fs')
var tar = require('tar')
-var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
+var basepath = common.pkg
var fixturepath = path.resolve(basepath, 'npm-test-files')
var targetpath = path.resolve(basepath, 'target')
var Tacks = require('tacks')
@@ -484,7 +484,7 @@ test('default-ignored files can be explicitly included', function (t) {
})
)
withFixture(t, fixture, function (done) {
- t.ok(fileExists('.git'), '.git included')
+ t.notOk(fileExists('.git'), '.git should never be included')
t.ok(fileExists('.svn'), '.svn included')
t.ok(fileExists('CVS'), 'CVS included')
t.ok(fileExists('.hg'), '.hg included')
diff --git a/deps/npm/test/tap/pack-scoped.js b/deps/npm/test/tap/pack-scoped.js
index 05b9d12a83..29d9aab478 100644
--- a/deps/npm/test/tap/pack-scoped.js
+++ b/deps/npm/test/tap/pack-scoped.js
@@ -6,7 +6,7 @@ var join = require('path').join
var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
-var pkg = join(__dirname, 'scoped_package')
+var pkg = common.pkg
var manifest = join(pkg, 'package.json')
var tmp = join(pkg, 'tmp')
var cache = join(pkg, 'cache')
diff --git a/deps/npm/test/tap/pack.js b/deps/npm/test/tap/pack.js
index 1813f47bf4..7aa42d4837 100644
--- a/deps/npm/test/tap/pack.js
+++ b/deps/npm/test/tap/pack.js
@@ -12,7 +12,7 @@ const Tacks = require('tacks')
const Dir = Tacks.Dir
const File = Tacks.File
-const testDir = path.join(__dirname, 'pkg')
+const testDir = common.pkg
const tmp = path.join(testDir, 'tmp')
const cache = path.join(testDir, 'cache')
diff --git a/deps/npm/test/tap/peer-deps.js b/deps/npm/test/tap/peer-deps.js
index b516818da1..20cbf5d1de 100644
--- a/deps/npm/test/tap/peer-deps.js
+++ b/deps/npm/test/tap/peer-deps.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
var npm = require('../../')
-var pkg = path.resolve(__dirname, 'peer-deps')
+var pkg = common.pkg
var expected = [ 'peer dep missing: request@0.9.x, required by npm-test-peer-deps@0.0.0' ]
diff --git a/deps/npm/test/tap/ping.js b/deps/npm/test/tap/ping.js
index 3562f25a3b..3687b05bd4 100644
--- a/deps/npm/test/tap/ping.js
+++ b/deps/npm/test/tap/ping.js
@@ -8,7 +8,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'ping')
+var pkg = common.pkg
var opts = { cwd: pkg }
var outfile = path.join(pkg, '_npmrc')
diff --git a/deps/npm/test/tap/prepare.js b/deps/npm/test/tap/prepare.js
index f179c52672..54edf7cb19 100644
--- a/deps/npm/test/tap/prepare.js
+++ b/deps/npm/test/tap/prepare.js
@@ -6,7 +6,7 @@ var join = require('path').join
var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
-var pkg = join(__dirname, 'prepare_package')
+var pkg = common.pkg
var tmp = join(pkg, 'tmp')
var cache = join(pkg, 'cache')
diff --git a/deps/npm/test/tap/prepublish-only.js b/deps/npm/test/tap/prepublish-only.js
index 0d2d31589d..9996479da4 100644
--- a/deps/npm/test/tap/prepublish-only.js
+++ b/deps/npm/test/tap/prepublish-only.js
@@ -10,7 +10,7 @@ var path = require('path')
var common = require('../common-tap')
-var pkg = join(__dirname, 'prepublish_package')
+var pkg = common.pkg
var cachedir = join(pkg, 'cache')
var tmpdir = join(pkg, 'tmp')
diff --git a/deps/npm/test/tap/prepublish.js b/deps/npm/test/tap/prepublish.js
index c71455a248..5628f94db3 100644
--- a/deps/npm/test/tap/prepublish.js
+++ b/deps/npm/test/tap/prepublish.js
@@ -6,7 +6,7 @@ var join = require('path').join
var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
-var pkg = join(__dirname, 'prepublish_package')
+var pkg = common.pkg
var tmp = join(pkg, 'tmp')
var cache = join(pkg, 'cache')
diff --git a/deps/npm/test/tap/progress-config.js b/deps/npm/test/tap/progress-config.js
index 94d9b15f1b..1f1e1a0c22 100644
--- a/deps/npm/test/tap/progress-config.js
+++ b/deps/npm/test/tap/progress-config.js
@@ -1,9 +1,9 @@
'use strict'
-var path = require('path')
var test = require('tap').test
var log = require('npmlog')
var fs = require('graceful-fs')
-var configName = path.join(__dirname, path.basename(__filename, '.js')) + '-npmrc'
+const common = require('../common-tap.js')
+var configName = common.pkg + '-npmrc'
// We use requireInject to get a fresh copy of
// the npm singleton each time we require it.
diff --git a/deps/npm/test/tap/prune-dev-dep-cycle.js b/deps/npm/test/tap/prune-dev-dep-cycle.js
index 5ccabdc1c9..e226ac6d32 100644
--- a/deps/npm/test/tap/prune-dev-dep-cycle.js
+++ b/deps/npm/test/tap/prune-dev-dep-cycle.js
@@ -1,12 +1,11 @@
'use strict'
var fs = require('fs')
-var path = require('path')
var test = require('tap').test
var Tacks = require('tacks')
var File = Tacks.File
var Dir = Tacks.Dir
var common = require('../common-tap.js')
-var testdir = path.join(__dirname, path.basename(__filename, '.js'))
+var testdir = common.pkg
var fixture = new Tacks(
Dir({
diff --git a/deps/npm/test/tap/prune-dev-dep-with-bins.js b/deps/npm/test/tap/prune-dev-dep-with-bins.js
index 686b5d8d6d..a75652f9a1 100644
--- a/deps/npm/test/tap/prune-dev-dep-with-bins.js
+++ b/deps/npm/test/tap/prune-dev-dep-with-bins.js
@@ -1,12 +1,11 @@
'use strict'
var fs = require('fs')
-var path = require('path')
var test = require('tap').test
var Tacks = require('tacks')
var File = Tacks.File
var Dir = Tacks.Dir
var common = require('../common-tap.js')
-var testdir = path.join(__dirname, path.basename(__filename, '.js'))
+var testdir = common.pkg
var fixture = new Tacks(
Dir({
diff --git a/deps/npm/test/tap/prune-with-dev-dep-duplicate.js b/deps/npm/test/tap/prune-with-dev-dep-duplicate.js
index bfe902b1d3..7efea5c01e 100644
--- a/deps/npm/test/tap/prune-with-dev-dep-duplicate.js
+++ b/deps/npm/test/tap/prune-with-dev-dep-duplicate.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var common = require('../common-tap')
var server
-var pkg = path.resolve(__dirname, 'prune')
+var pkg = common.pkg
var cache = path.resolve(pkg, 'cache')
var json = {
diff --git a/deps/npm/test/tap/prune-with-only-dev-deps.js b/deps/npm/test/tap/prune-with-only-dev-deps.js
index dce9497e51..c8e87a5356 100644
--- a/deps/npm/test/tap/prune-with-only-dev-deps.js
+++ b/deps/npm/test/tap/prune-with-only-dev-deps.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var common = require('../common-tap')
var server
-var pkg = path.resolve(__dirname, 'prune')
+var pkg = common.pkg
var cache = path.resolve(pkg, 'cache')
var json = {
diff --git a/deps/npm/test/tap/prune.js b/deps/npm/test/tap/prune.js
index 4fe586359e..6e033ceae0 100644
--- a/deps/npm/test/tap/prune.js
+++ b/deps/npm/test/tap/prune.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var common = require('../common-tap')
var server
-var pkg = path.resolve(__dirname, path.basename(__filename, '.js'))
+var pkg = common.pkg
var cache = path.resolve(pkg, 'cache')
var json = {
diff --git a/deps/npm/test/tap/publish-access-scoped.js b/deps/npm/test/tap/publish-access-scoped.js
index 17339cedfd..31b1bed26c 100644
--- a/deps/npm/test/tap/publish-access-scoped.js
+++ b/deps/npm/test/tap/publish-access-scoped.js
@@ -8,7 +8,7 @@ var mr = require('npm-registry-mock')
var common = require('../common-tap')
var server
-var pkg = path.join(__dirname, 'publish-access')
+var pkg = common.pkg
test('setup', function (t) {
mr({port: common.port, throwOnUnmatched: true}, function (err, s) {
diff --git a/deps/npm/test/tap/publish-access-unscoped-restricted-fails.js b/deps/npm/test/tap/publish-access-unscoped-restricted-fails.js
index 660d0f48d7..f615fa60f2 100644
--- a/deps/npm/test/tap/publish-access-unscoped-restricted-fails.js
+++ b/deps/npm/test/tap/publish-access-unscoped-restricted-fails.js
@@ -6,7 +6,7 @@ var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
var common = require('../common-tap.js')
-var pkg = path.join(__dirname, 'publish-access-unscoped')
+var pkg = common.pkg
test('setup', function (t) {
mkdirp.sync(pkg)
diff --git a/deps/npm/test/tap/publish-access-unscoped.js b/deps/npm/test/tap/publish-access-unscoped.js
index 1766f61f4f..a2489e2bca 100644
--- a/deps/npm/test/tap/publish-access-unscoped.js
+++ b/deps/npm/test/tap/publish-access-unscoped.js
@@ -8,7 +8,7 @@ var mr = require('npm-registry-mock')
var common = require('../common-tap')
var server
-var pkg = path.join(__dirname, 'publish-access-unscoped')
+var pkg = common.pkg
test('setup', function (t) {
mr({port: common.port, throwOnUnmatched: true}, function (err, s) {
diff --git a/deps/npm/test/tap/publish-config.js b/deps/npm/test/tap/publish-config.js
index 14fd40311a..705ef7ae7a 100644
--- a/deps/npm/test/tap/publish-config.js
+++ b/deps/npm/test/tap/publish-config.js
@@ -17,9 +17,9 @@ fs.writeFileSync(pkg + '/package.json', JSON.stringify({
}), 'utf8')
fs.writeFileSync(pkg + '/fixture_npmrc',
- '//localhost:1337/:email = fancy@feast.net\n' +
- '//localhost:1337/:username = fancy\n' +
- '//localhost:1337/:_password = ' + Buffer.from('feast').toString('base64'))
+ '//localhost:' + common.port + '/:email = fancy@feast.net\n' +
+ '//localhost:' + common.port + '/:username = fancy\n' +
+ '//localhost:' + common.port + '/:_password = ' + Buffer.from('feast').toString('base64'))
test(function (t) {
let child
diff --git a/deps/npm/test/tap/publish-invalid-semver-tag.js b/deps/npm/test/tap/publish-invalid-semver-tag.js
index 21543869a5..400030908b 100644
--- a/deps/npm/test/tap/publish-invalid-semver-tag.js
+++ b/deps/npm/test/tap/publish-invalid-semver-tag.js
@@ -9,7 +9,7 @@ var mr = require('npm-registry-mock')
var osenv = require('osenv')
-var PKG_DIR = path.resolve(__dirname, 'publish-invalid-semver-tag')
+var PKG_DIR = common.pkg
var CACHE_DIR = path.resolve(PKG_DIR, 'cache')
var DEFAULT_PKG = {
diff --git a/deps/npm/test/tap/publish-scoped.js b/deps/npm/test/tap/publish-scoped.js
index b8fe0ae2f6..efa86c8539 100644
--- a/deps/npm/test/tap/publish-scoped.js
+++ b/deps/npm/test/tap/publish-scoped.js
@@ -7,7 +7,7 @@ var rimraf = require('rimraf')
var common = require('../common-tap')
var mr = require('npm-registry-mock')
-var pkg = path.join(__dirname, 'prepublish_package')
+var pkg = common.pkg
var server
@@ -42,9 +42,9 @@ test('npm publish should honor scoping', function (t) {
'progress=false',
'cache=' + path.join(pkg, 'cache'),
'registry=http://nonexistent.lvh.me',
- '//localhost:1337/:username=username',
- '//localhost:1337/:_password=' + Buffer.from('password').toString('base64'),
- '//localhost:1337/:email=' + 'ogd@aoaioxxysz.net',
+ '//localhost:' + common.port + '/:username=username',
+ '//localhost:' + common.port + '/:_password=' + Buffer.from('password').toString('base64'),
+ '//localhost:' + common.port + '/:email=' + 'ogd@aoaioxxysz.net',
'@bigco:registry=' + common.registry
]
var configFile = path.join(pkg, '.npmrc')
diff --git a/deps/npm/test/tap/publish.js b/deps/npm/test/tap/publish.js
index 765cfb07c6..c507044433 100644
--- a/deps/npm/test/tap/publish.js
+++ b/deps/npm/test/tap/publish.js
@@ -10,7 +10,7 @@ const path = require('path')
const rimraf = require('rimraf')
const test = require('tap').test
-const testDir = path.join(__dirname, 'publish_test_package')
+const testDir = common.pkg
function setup () {
cleanup()
@@ -125,8 +125,8 @@ test('npm publish --json', (t) => {
name: 'publish-organized',
version: '1.2.5',
files: [
- {path: 'package.json'},
- {path: 'index.js'}
+ {path: 'index.js'},
+ {path: 'package.json'}
],
entryCount: 2
}, 'JSON output reflects package contents')
@@ -154,8 +154,8 @@ test('npm publish --dry-run --json', (t) => {
name: 'publish-organized',
version: '1.2.5',
files: [
- {path: 'package.json'},
- {path: 'index.js'}
+ {path: 'index.js'},
+ {path: 'package.json'}
],
entryCount: 2
}, 'JSON output reflects package contents')
diff --git a/deps/npm/test/tap/repo.js b/deps/npm/test/tap/repo.js
index 54907f620c..0ee50af192 100644
--- a/deps/npm/test/tap/repo.js
+++ b/deps/npm/test/tap/repo.js
@@ -5,16 +5,17 @@ var test = require('tap').test
var rimraf = require('rimraf')
var fs = require('fs')
var path = require('path')
-var fakeBrowser = path.join(__dirname, '_script.sh')
-var outFile = path.join(__dirname, '/_output')
-
-var opts = { cwd: __dirname }
+var fakeBrowser = path.join(common.pkg, '_script.sh')
+var outFile = path.join(common.pkg, '_output')
+var opts = { cwd: common.pkg }
+var mkdirp = require('mkdirp')
common.pendIfWindows('This is trickier to convert without opening new shells')
test('setup', function (t) {
+ mkdirp.sync(common.pkg)
var s = '#!/usr/bin/env bash\n' +
- 'echo "$@" > ' + JSON.stringify(__dirname) + '/_output\n'
+ 'echo "$@" > ' + JSON.stringify(common.pkg) + '/_output\n'
fs.writeFileSync(fakeBrowser, s, 'ascii')
fs.chmodSync(fakeBrowser, '0755')
t.pass('made script')
diff --git a/deps/npm/test/tap/retry-on-stale-cache.js b/deps/npm/test/tap/retry-on-stale-cache.js
index 8aec35ed4f..129c52c160 100644
--- a/deps/npm/test/tap/retry-on-stale-cache.js
+++ b/deps/npm/test/tap/retry-on-stale-cache.js
@@ -7,7 +7,7 @@ var Tacks = require('tacks')
var Dir = Tacks.Dir
var File = Tacks.File
-var workdir = path.join(__dirname, path.basename(__filename, '.js'))
+var workdir = common.pkg
var cachedir = path.join(workdir, 'cache')
var modulesdir = path.join(workdir, 'modules')
var oldModule = path.join(modulesdir, 'good-night-0.1.0.tgz')
diff --git a/deps/npm/test/tap/run-script-filter-private.js b/deps/npm/test/tap/run-script-filter-private.js
index 631759c13a..31f1912fd1 100644
--- a/deps/npm/test/tap/run-script-filter-private.js
+++ b/deps/npm/test/tap/run-script-filter-private.js
@@ -7,7 +7,7 @@ var test = require('tap').test
var common = require('../common-tap')
-var pkg = path.resolve(__dirname, 'run-script-filter-private')
+var pkg = common.pkg
var opts = { cwd: pkg }
diff --git a/deps/npm/test/tap/run-script.js b/deps/npm/test/tap/run-script.js
index f50a963285..a937abadf2 100644
--- a/deps/npm/test/tap/run-script.js
+++ b/deps/npm/test/tap/run-script.js
@@ -7,7 +7,7 @@ var rimraf = require('rimraf')
var common = require('../common-tap')
-var pkg = path.resolve(__dirname, 'run-script')
+var pkg = common.pkg
var cache = path.resolve(pkg, 'cache')
var tmp = path.resolve(pkg, 'tmp')
diff --git a/deps/npm/test/tap/save-optional.js b/deps/npm/test/tap/save-optional.js
index 66e430dc78..c293401f52 100644
--- a/deps/npm/test/tap/save-optional.js
+++ b/deps/npm/test/tap/save-optional.js
@@ -8,7 +8,7 @@ const File = Tacks.File
const Dir = Tacks.Dir
const common = require('../common-tap.js')
-const basedir = path.join(__dirname, path.basename(__filename, '.js'))
+const basedir = common.pkg
const testdir = path.join(basedir, 'testdir')
const cachedir = path.join(basedir, 'cache')
const globaldir = path.join(basedir, 'global')
diff --git a/deps/npm/test/tap/scope-header.js b/deps/npm/test/tap/scope-header.js
index 3eb70f132e..f291b3a500 100644
--- a/deps/npm/test/tap/scope-header.js
+++ b/deps/npm/test/tap/scope-header.js
@@ -7,7 +7,7 @@ var File = Tacks.File
var Dir = Tacks.Dir
var common = require('../common-tap.js')
-var basedir = path.join(__dirname, path.basename(__filename, '.js'))
+var basedir = common.pkg
var testdir = path.join(basedir, 'testdir')
var withScope = path.join(testdir, 'with-scope')
var withoutScope = path.join(testdir, 'without-scope')
diff --git a/deps/npm/test/tap/scripts-whitespace-windows.js b/deps/npm/test/tap/scripts-whitespace-windows.js
index 4d1e53a8f5..9378564bb5 100644
--- a/deps/npm/test/tap/scripts-whitespace-windows.js
+++ b/deps/npm/test/tap/scripts-whitespace-windows.js
@@ -8,7 +8,7 @@ var test = require('tap').test
var common = require('../common-tap')
-var pkg = path.resolve(__dirname, 'scripts-whitespace-windows')
+var pkg = common.pkg
var tmp = path.resolve(pkg, 'tmp')
var cache = path.resolve(pkg, 'cache')
var dep = path.resolve(pkg, 'dep')
diff --git a/deps/npm/test/tap/search.all-package-search.js b/deps/npm/test/tap/search.all-package-search.js
index 51c1ffcf90..419e4fdeed 100644
--- a/deps/npm/test/tap/search.all-package-search.js
+++ b/deps/npm/test/tap/search.all-package-search.js
@@ -14,7 +14,7 @@ const {File} = Tacks
const common = require('../common-tap.js')
-const PKG_DIR = path.resolve(__dirname, 'search')
+const PKG_DIR = common.pkg
const CACHE_DIR = path.resolve(PKG_DIR, 'cache')
const cacheBase = cacheFile(CACHE_DIR)(common.registry + '/-/all')
const cachePath = path.join(cacheBase, '.cache.json')
diff --git a/deps/npm/test/tap/search.js b/deps/npm/test/tap/search.js
index bbd293c3a1..70d17e5469 100644
--- a/deps/npm/test/tap/search.js
+++ b/deps/npm/test/tap/search.js
@@ -14,7 +14,7 @@ const File = Tacks.File
const common = require('../common-tap.js')
-const PKG_DIR = path.resolve(__dirname, 'search')
+const PKG_DIR = common.pkg
const CACHE_DIR = path.resolve(PKG_DIR, 'cache')
const cacheBase = cacheFile(CACHE_DIR)(common.registry + '/-/all')
const cachePath = path.join(cacheBase, '.cache.json')
diff --git a/deps/npm/test/tap/shared-linked.js b/deps/npm/test/tap/shared-linked.js
index 3ee00e063d..bb2d9bd459 100644
--- a/deps/npm/test/tap/shared-linked.js
+++ b/deps/npm/test/tap/shared-linked.js
@@ -8,7 +8,7 @@ var Dir = Tacks.Dir
var common = require('../common-tap.js')
var mr = require('npm-registry-mock')
-var testdir = path.join(__dirname, path.basename(__filename, '.js'))
+var testdir = common.pkg
var bugdir = path.join(testdir, 'modules', 'bug')
// This is an absolutely minimal version of the optimist included with
diff --git a/deps/npm/test/tap/shrinkwrap-_auth.js b/deps/npm/test/tap/shrinkwrap-_auth.js
index 5aff86fb08..156bd9667c 100644
--- a/deps/npm/test/tap/shrinkwrap-_auth.js
+++ b/deps/npm/test/tap/shrinkwrap-_auth.js
@@ -13,7 +13,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, path.basename(__filename, '.js'))
+var pkg = common.pkg
var outfile = path.resolve(pkg, '_npmrc')
var modules = path.resolve(pkg, 'node_modules')
diff --git a/deps/npm/test/tap/shrinkwrap-default-dev.js b/deps/npm/test/tap/shrinkwrap-default-dev.js
index 48f9f2a90a..9ff998fa48 100644
--- a/deps/npm/test/tap/shrinkwrap-default-dev.js
+++ b/deps/npm/test/tap/shrinkwrap-default-dev.js
@@ -7,7 +7,7 @@ var File = Tacks.File
var Dir = Tacks.Dir
var common = require('../common-tap.js')
-var basedir = path.join(__dirname, path.basename(__filename, '.js'))
+var basedir = common.pkg
var testdir = path.join(basedir, 'testdir')
var cachedir = path.join(basedir, 'cache')
var globaldir = path.join(basedir, 'global')
diff --git a/deps/npm/test/tap/shrinkwrap-dev-dependency.js b/deps/npm/test/tap/shrinkwrap-dev-dependency.js
index 79d3b7cd0f..8006aa9ea8 100644
--- a/deps/npm/test/tap/shrinkwrap-dev-dependency.js
+++ b/deps/npm/test/tap/shrinkwrap-dev-dependency.js
@@ -9,7 +9,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'shrinkwrap-dev-dependency')
+var pkg = common.pkg
var opts = [
'--cache', path.resolve(pkg, 'cache'),
diff --git a/deps/npm/test/tap/shrinkwrap-empty-deps.js b/deps/npm/test/tap/shrinkwrap-empty-deps.js
index eeb5e656ef..af9b4810af 100644
--- a/deps/npm/test/tap/shrinkwrap-empty-deps.js
+++ b/deps/npm/test/tap/shrinkwrap-empty-deps.js
@@ -9,7 +9,7 @@ const path = require('path')
const rimraf = require('rimraf')
const test = require('tap').test
-const pkg = path.resolve(__dirname, 'shrinkwrap-empty-deps')
+const pkg = common.pkg
const EXEC_OPTS = { cwd: pkg }
diff --git a/deps/npm/test/tap/shrinkwrap-extra-metadata.js b/deps/npm/test/tap/shrinkwrap-extra-metadata.js
index dd7f85ee82..a5ff721a7a 100644
--- a/deps/npm/test/tap/shrinkwrap-extra-metadata.js
+++ b/deps/npm/test/tap/shrinkwrap-extra-metadata.js
@@ -10,7 +10,7 @@ const path = require('path')
const rimraf = require('rimraf')
const test = require('tap').test
-const pkg = path.join(__dirname, path.basename(__filename, '.js'))
+const pkg = common.pkg
const json = {
author: 'Rockbert',
diff --git a/deps/npm/test/tap/shrinkwrap-global-auth.js b/deps/npm/test/tap/shrinkwrap-global-auth.js
index 76fa0a4662..e860abd2fe 100644
--- a/deps/npm/test/tap/shrinkwrap-global-auth.js
+++ b/deps/npm/test/tap/shrinkwrap-global-auth.js
@@ -13,7 +13,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, path.basename(__filename, '.js'))
+var pkg = common.pkg
var outfile = path.resolve(pkg, '_npmrc')
var modules = path.resolve(pkg, 'node_modules')
diff --git a/deps/npm/test/tap/shrinkwrap-lifecycle-cwd.js b/deps/npm/test/tap/shrinkwrap-lifecycle-cwd.js
index bc9ab9cf11..203c2165eb 100644
--- a/deps/npm/test/tap/shrinkwrap-lifecycle-cwd.js
+++ b/deps/npm/test/tap/shrinkwrap-lifecycle-cwd.js
@@ -7,7 +7,7 @@ var File = Tacks.File
var Dir = Tacks.Dir
var common = require('../common-tap.js')
-var basedir = path.join(__dirname, path.basename(__filename, '.js'))
+var basedir = common.pkg
var testdir = path.join(basedir, 'testdir')
var cachedir = path.join(basedir, 'cache')
var globaldir = path.join(basedir, 'global')
diff --git a/deps/npm/test/tap/shrinkwrap-lifecycle.js b/deps/npm/test/tap/shrinkwrap-lifecycle.js
index 8c0f36e3bb..5ed35e1868 100644
--- a/deps/npm/test/tap/shrinkwrap-lifecycle.js
+++ b/deps/npm/test/tap/shrinkwrap-lifecycle.js
@@ -7,7 +7,7 @@ var rimraf = require('rimraf')
var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'shrinkwrap-lifecycle')
+var pkg = common.pkg
test('npm shrinkwrap execution order', function (t) {
setup()
diff --git a/deps/npm/test/tap/shrinkwrap-local-dependency.js b/deps/npm/test/tap/shrinkwrap-local-dependency.js
index d1c33b99a5..d737b10bb6 100644
--- a/deps/npm/test/tap/shrinkwrap-local-dependency.js
+++ b/deps/npm/test/tap/shrinkwrap-local-dependency.js
@@ -8,7 +8,7 @@ var unixFormatPath = require('../../lib/utils/unix-format-path.js')
var File = Tacks.File
var Dir = Tacks.Dir
-var testdir = path.resolve(__dirname, path.basename(__filename, '.js'))
+var testdir = common.pkg
var cachedir = path.resolve(testdir, 'cache')
var config = ['--cache=' + cachedir, '--loglevel=error']
diff --git a/deps/npm/test/tap/shrinkwrap-nested.js b/deps/npm/test/tap/shrinkwrap-nested.js
index 44d0cb0b2f..bace44d01a 100644
--- a/deps/npm/test/tap/shrinkwrap-nested.js
+++ b/deps/npm/test/tap/shrinkwrap-nested.js
@@ -8,7 +8,7 @@ var fs = require('fs')
var path = require('path')
var common = require('../common-tap.js')
-var testdir = path.resolve(__dirname, path.basename(__filename, '.js'))
+var testdir = common.pkg
var modAtgz = path.resolve(testdir, 'modA') + '-1.0.0.tgz'
var modB1tgz = path.resolve(testdir, 'modB') + '-1.0.0.tgz'
var modB2tgz = path.resolve(testdir, 'modB') + '-2.0.0.tgz'
diff --git a/deps/npm/test/tap/shrinkwrap-optional-dependency.js b/deps/npm/test/tap/shrinkwrap-optional-dependency.js
index 5085dd0cbb..f2c853ac4b 100644
--- a/deps/npm/test/tap/shrinkwrap-optional-dependency.js
+++ b/deps/npm/test/tap/shrinkwrap-optional-dependency.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
var npm = require('../../')
-var pkg = path.resolve(__dirname, 'shrinkwrap-optional-dependency')
+var pkg = common.pkg
test('shrinkwrap does not fail on missing optional dependency', function (t) {
t.plan(1)
diff --git a/deps/npm/test/tap/shrinkwrap-optional-platform.js b/deps/npm/test/tap/shrinkwrap-optional-platform.js
index b109d89578..d6a3c41b51 100644
--- a/deps/npm/test/tap/shrinkwrap-optional-platform.js
+++ b/deps/npm/test/tap/shrinkwrap-optional-platform.js
@@ -6,7 +6,7 @@ var File = Tacks.File
var Dir = Tacks.Dir
var common = require('../common-tap.js')
-var basedir = path.join(__dirname, path.basename(__filename, '.js'))
+var basedir = common.pkg
var testdir = path.join(basedir, 'testdir')
var cachedir = path.join(basedir, 'cache')
var globaldir = path.join(basedir, 'global')
diff --git a/deps/npm/test/tap/shrinkwrap-optional-property.js b/deps/npm/test/tap/shrinkwrap-optional-property.js
index ccff5a93e2..84bc5cb258 100644
--- a/deps/npm/test/tap/shrinkwrap-optional-property.js
+++ b/deps/npm/test/tap/shrinkwrap-optional-property.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
var npm = require('../../')
-var pkg = path.resolve(__dirname, 'shrinkwrap-optional-dependency')
+var pkg = common.pkg
test('shrinkwrap adds optional property when optional dependency', function (t) {
t.plan(1)
@@ -58,7 +58,7 @@ var desired = {
},
'underscore': {
version: '1.3.3',
- resolved: 'http://localhost:1337/underscore/-/underscore-1.3.3.tgz',
+ resolved: 'http://localhost:' + common.port + '/underscore/-/underscore-1.3.3.tgz',
optional: true,
integrity: 'sha1-R6xTaD2vgyv6lS4XdEF9pHgXrkI='
}
diff --git a/deps/npm/test/tap/shrinkwrap-prod-dependency-also.js b/deps/npm/test/tap/shrinkwrap-prod-dependency-also.js
index 6cc388946e..94f3c4ac90 100644
--- a/deps/npm/test/tap/shrinkwrap-prod-dependency-also.js
+++ b/deps/npm/test/tap/shrinkwrap-prod-dependency-also.js
@@ -8,7 +8,7 @@ var rimraf = require('rimraf')
var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, path.basename(__filename, '.js'))
+var pkg = common.pkg
var opts = [
'--cache=' + path.resolve(pkg, 'cache'),
'--registry=' + common.registry
diff --git a/deps/npm/test/tap/shrinkwrap-prod-dependency.js b/deps/npm/test/tap/shrinkwrap-prod-dependency.js
index 34e30d7c7a..eb04db9ca1 100644
--- a/deps/npm/test/tap/shrinkwrap-prod-dependency.js
+++ b/deps/npm/test/tap/shrinkwrap-prod-dependency.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var npm = require('../../')
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'shrinkwrap-prod-dependency')
+var pkg = common.pkg
test("shrinkwrap --dev doesn't strip out prod dependencies", function (t) {
t.plan(1)
diff --git a/deps/npm/test/tap/shrinkwrap-resolve-conflict.js b/deps/npm/test/tap/shrinkwrap-resolve-conflict.js
index 146d1191bf..d1f63f7e62 100644
--- a/deps/npm/test/tap/shrinkwrap-resolve-conflict.js
+++ b/deps/npm/test/tap/shrinkwrap-resolve-conflict.js
@@ -12,7 +12,7 @@ const Tacks = require('tacks')
const File = Tacks.File
const Dir = Tacks.Dir
-const testDir = path.resolve(__dirname, path.basename(__filename, '.js'))
+const testDir = common.pkg
const modAdir = path.resolve(testDir, 'modA')
const modBdir = path.resolve(testDir, 'modB')
const modCdir = path.resolve(testDir, 'modC')
diff --git a/deps/npm/test/tap/shrinkwrap-save-dev-with-existing-deps.js b/deps/npm/test/tap/shrinkwrap-save-dev-with-existing-deps.js
index 5934a758da..a71408e54f 100644
--- a/deps/npm/test/tap/shrinkwrap-save-dev-with-existing-deps.js
+++ b/deps/npm/test/tap/shrinkwrap-save-dev-with-existing-deps.js
@@ -9,7 +9,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var base = path.resolve(__dirname, path.basename(__filename, '.js'))
+var base = common.pkg
var installme = path.join(base, 'installme')
var installme_pkg = path.join(installme, 'package.json')
var example = path.join(base, 'example')
diff --git a/deps/npm/test/tap/shrinkwrap-save-with-existing-dev-deps.js b/deps/npm/test/tap/shrinkwrap-save-with-existing-dev-deps.js
index 5f0eb07962..fcbbeeffdd 100644
--- a/deps/npm/test/tap/shrinkwrap-save-with-existing-dev-deps.js
+++ b/deps/npm/test/tap/shrinkwrap-save-with-existing-dev-deps.js
@@ -9,7 +9,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var base = path.resolve(__dirname, path.basename(__filename, '.js'))
+var base = common.pkg
var installme = path.join(base, 'installme')
var installme_pkg = path.join(installme, 'package.json')
var example = path.join(base, 'example')
diff --git a/deps/npm/test/tap/shrinkwrap-scoped-auth.js b/deps/npm/test/tap/shrinkwrap-scoped-auth.js
index 72c3b51198..3098b8aa12 100644
--- a/deps/npm/test/tap/shrinkwrap-scoped-auth.js
+++ b/deps/npm/test/tap/shrinkwrap-scoped-auth.js
@@ -14,7 +14,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
var toNerfDart = require('../../lib/config/nerf-dart.js')
-var pkg = path.resolve(__dirname, path.basename(__filename, '.js'))
+var pkg = common.pkg
var outfile = path.resolve(pkg, '_npmrc')
var modules = path.resolve(pkg, 'node_modules')
var tarballPath = '/scoped-underscore/-/scoped-underscore-1.3.1.tgz'
diff --git a/deps/npm/test/tap/shrinkwrap-shared-dev-dependency.js b/deps/npm/test/tap/shrinkwrap-shared-dev-dependency.js
index 8960c09261..6a4ceb1970 100644
--- a/deps/npm/test/tap/shrinkwrap-shared-dev-dependency.js
+++ b/deps/npm/test/tap/shrinkwrap-shared-dev-dependency.js
@@ -8,7 +8,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, path.basename(__filename, '.js'))
+var pkg = common.pkg
var opts = {
env: common.newEnv().extend({
diff --git a/deps/npm/test/tap/shrinkwrap-version-match.js b/deps/npm/test/tap/shrinkwrap-version-match.js
index 57906528f7..e579f84d4b 100644
--- a/deps/npm/test/tap/shrinkwrap-version-match.js
+++ b/deps/npm/test/tap/shrinkwrap-version-match.js
@@ -7,7 +7,7 @@ var fs = require('fs')
var path = require('path')
var common = require('../common-tap.js')
-var testdir = path.resolve(__dirname, path.basename(__filename, '.js'))
+var testdir = common.pkg
var modAdir = path.resolve(testdir, 'modA')
var modB1dir = path.resolve(testdir, 'modB@1')
var modB2dir = path.resolve(testdir, 'modB@2')
diff --git a/deps/npm/test/tap/sorted-package-json.js b/deps/npm/test/tap/sorted-package-json.js
index 557f3dc53d..d67b729f68 100644
--- a/deps/npm/test/tap/sorted-package-json.js
+++ b/deps/npm/test/tap/sorted-package-json.js
@@ -2,11 +2,11 @@ var test = require('tap').test
var path = require('path')
var rimraf = require('rimraf')
var mkdirp = require('mkdirp')
-var pkg = path.resolve(__dirname, 'sorted-package-json')
+var common = require('../common-tap.js')
+var pkg = common.pkg
var tmp = path.join(pkg, 'tmp')
var cache = path.join(pkg, 'cache')
var fs = require('fs')
-var common = require('../common-tap.js')
var mr = require('npm-registry-mock')
var osenv = require('osenv')
var packageJson = path.resolve(pkg, 'package.json')
diff --git a/deps/npm/test/tap/spawn-enoent-help.js b/deps/npm/test/tap/spawn-enoent-help.js
index d4a6fcdd83..cb7c942be8 100644
--- a/deps/npm/test/tap/spawn-enoent-help.js
+++ b/deps/npm/test/tap/spawn-enoent-help.js
@@ -1,10 +1,9 @@
-var path = require('path')
var test = require('tap').test
var rimraf = require('rimraf')
var mkdirp = require('mkdirp')
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'spawn-enoent-help')
+var pkg = common.pkg
common.pendIfWindows('man pages are not built on Windows')
diff --git a/deps/npm/test/tap/spawn-enoent.js b/deps/npm/test/tap/spawn-enoent.js
index c81460fdcf..78153572ee 100644
--- a/deps/npm/test/tap/spawn-enoent.js
+++ b/deps/npm/test/tap/spawn-enoent.js
@@ -1,11 +1,10 @@
-var path = require('path')
var test = require('tap').test
var fs = require('fs')
var rimraf = require('rimraf')
var mkdirp = require('mkdirp')
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'spawn-enoent')
+var pkg = common.pkg
var pj = JSON.stringify({
name: 'x',
version: '1.2.3',
diff --git a/deps/npm/test/tap/spec-local-specifiers.js b/deps/npm/test/tap/spec-local-specifiers.js
index 3601eee5f3..7b6cacf12c 100644
--- a/deps/npm/test/tap/spec-local-specifiers.js
+++ b/deps/npm/test/tap/spec-local-specifiers.js
@@ -11,7 +11,7 @@ var Dir = Tacks.Dir
var common = require('../common-tap.js')
var isWindows = require('../../lib/utils/is-windows.js')
-var basedir = path.join(__dirname, path.basename(__filename, '.js'))
+var basedir = common.pkg
var testdir = path.join(basedir, 'testdir')
var cachedir = path.join(basedir, 'cache')
var globaldir = path.join(basedir, 'global')
diff --git a/deps/npm/test/tap/splat-with-only-prerelease-to-latest.js b/deps/npm/test/tap/splat-with-only-prerelease-to-latest.js
index cf5aac110b..5720a2cdce 100644
--- a/deps/npm/test/tap/splat-with-only-prerelease-to-latest.js
+++ b/deps/npm/test/tap/splat-with-only-prerelease-to-latest.js
@@ -8,7 +8,7 @@ const path = require('path')
const rimraf = require('rimraf')
const test = require('tap').test
-const testdir = path.join(__dirname, path.basename(__filename, '.js'))
+const testdir = common.pkg
const moduleName = 'xyzzy-wibble'
const testModule = {
diff --git a/deps/npm/test/tap/startstop.js b/deps/npm/test/tap/startstop.js
index 0e9d2d9402..3491441821 100644
--- a/deps/npm/test/tap/startstop.js
+++ b/deps/npm/test/tap/startstop.js
@@ -8,7 +8,7 @@ var test = require('tap').test
var common = require('../common-tap')
-var pkg = path.resolve(__dirname, 'startstop')
+var pkg = common.pkg
var EXEC_OPTS = { cwd: pkg }
diff --git a/deps/npm/test/tap/symlink-cycle.js b/deps/npm/test/tap/symlink-cycle.js
index 5bee2c5569..d59a2763bd 100644
--- a/deps/npm/test/tap/symlink-cycle.js
+++ b/deps/npm/test/tap/symlink-cycle.js
@@ -8,7 +8,7 @@ var rimraf = require('rimraf')
var writeFileSync = require('fs').writeFileSync
var common = require('../common-tap.js')
-var base = path.join(__dirname, path.basename(__filename, '.js'))
+var base = common.pkg
var cycle = path.join(base, 'cycle')
var cycleJSON = {
diff --git a/deps/npm/test/tap/tag-version-prefix.js b/deps/npm/test/tap/tag-version-prefix.js
index 555de1af16..b72255a226 100644
--- a/deps/npm/test/tap/tag-version-prefix.js
+++ b/deps/npm/test/tap/tag-version-prefix.js
@@ -9,7 +9,7 @@ var test = require('tap').test
var npm = require('../../lib/npm.js')
-var pkg = path.resolve(__dirname, 'version-message-config')
+var pkg = common.pkg
var cache = path.resolve(pkg, 'cache')
var npmrc = path.resolve(pkg, '.npmrc')
var packagePath = path.resolve(pkg, 'package.json')
diff --git a/deps/npm/test/tap/tagged-version-matching.js b/deps/npm/test/tap/tagged-version-matching.js
index 55dfb7b7c4..64522745c8 100644
--- a/deps/npm/test/tap/tagged-version-matching.js
+++ b/deps/npm/test/tap/tagged-version-matching.js
@@ -7,7 +7,7 @@ var Dir = Tacks.Dir
var Symlink = Tacks.Symlink
var common = require('../common-tap.js')
-var basedir = path.join(__dirname, path.basename(__filename, '.js'))
+var basedir = common.pkg
var testdir = path.join(basedir, 'testdir')
var cachedir = path.join(basedir, 'cache')
var globaldir = path.join(basedir, 'global')
diff --git a/deps/npm/test/tap/tree-style.js b/deps/npm/test/tap/tree-style.js
index 12fdb0bbd9..5d8abef369 100644
--- a/deps/npm/test/tap/tree-style.js
+++ b/deps/npm/test/tap/tree-style.js
@@ -7,7 +7,7 @@ var rimraf = require('rimraf')
var fs = require('graceful-fs')
var common = require('../common-tap')
-var base = path.resolve(__dirname, path.basename(__filename, '.js'))
+var base = common.pkg
var modA = path.resolve(base, 'modA')
var modB = path.resolve(base, 'modB')
var modC = path.resolve(base, 'modC')
diff --git a/deps/npm/test/tap/umask-lifecycle.js b/deps/npm/test/tap/umask-lifecycle.js
index c4c3233637..8b365d6233 100644
--- a/deps/npm/test/tap/umask-lifecycle.js
+++ b/deps/npm/test/tap/umask-lifecycle.js
@@ -1,5 +1,4 @@
var fs = require('fs')
-var path = require('path')
var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
@@ -9,7 +8,7 @@ var sprintf = require('sprintf-js').sprintf
var escapeExecPath = require('../../lib/utils/escape-exec-path.js')
var escapeArg = require('../../lib/utils/escape-arg.js')
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'umask-lifecycle')
+var pkg = common.pkg
var nodeCmd = escapeExecPath(common.nodeBin)
var npmCmd = nodeCmd + ' ' + escapeArg(common.bin)
@@ -24,7 +23,7 @@ var pj = JSON.stringify({
var umask = process.umask()
var expected = [
'',
- '> x@1.2.3 umask ' + path.join(__dirname, 'umask-lifecycle'),
+ '> x@1.2.3 umask ' + pkg,
'> ' + umaskScript,
'',
sprintf('%04o', umask),
diff --git a/deps/npm/test/tap/uninstall-link-clean.js b/deps/npm/test/tap/uninstall-link-clean.js
index 2b1d244d00..e21c370f60 100644
--- a/deps/npm/test/tap/uninstall-link-clean.js
+++ b/deps/npm/test/tap/uninstall-link-clean.js
@@ -8,7 +8,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var testdir = path.join(__dirname, path.basename(__filename, '.js'))
+var testdir = common.pkg
var pkg = path.join(testdir, 'pkg')
var dep = path.join(testdir, 'dep')
var work = path.join(testdir, 'uninstall-link-clean-TEST')
diff --git a/deps/npm/test/tap/uninstall-package.js b/deps/npm/test/tap/uninstall-package.js
index 7cc7b1da1f..87fdee2281 100644
--- a/deps/npm/test/tap/uninstall-package.js
+++ b/deps/npm/test/tap/uninstall-package.js
@@ -9,7 +9,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
-var pkg = path.join(__dirname, 'uninstall-package')
+var pkg = common.pkg
var EXEC_OPTS = { cwd: pkg, stdio: [0, 'pipe', 2] }
@@ -18,7 +18,8 @@ var json = {
version: '0.0.0',
dependencies: {
underscore: '~1.3.1',
- request: '~0.9.0'
+ request: '~0.9.0',
+ '@isaacs/namespace-test': '1.x'
}
}
@@ -69,6 +70,27 @@ test('returns a list of removed items', function (t) {
})
})
+test('does not fail if installed package lacks a name somehow', function (t) {
+ const scope = path.resolve(pkg, 'node_modules/@isaacs')
+ const scopePkg = path.resolve(scope, 'namespace-test')
+ const pj = path.resolve(scopePkg, 'package.json')
+ fs.writeFileSync(pj, JSON.stringify({
+ lol: 'yolo',
+ name: 99
+ }))
+ common.npm(
+ ['uninstall', '@isaacs/namespace-test'],
+ EXEC_OPTS,
+ function (err, code, stdout, stderr) {
+ if (err) throw err
+ t.equal(code, 0, 'should exit successfully')
+ t.has(stdout, /removed 1 package in/)
+ t.notOk(fs.existsSync(scope), 'scoped package removed')
+ t.end()
+ }
+ )
+})
+
test('cleanup', function (t) {
cleanup()
t.end()
diff --git a/deps/npm/test/tap/uninstall-save.js b/deps/npm/test/tap/uninstall-save.js
index 9bf342d7cf..0605616e07 100644
--- a/deps/npm/test/tap/uninstall-save.js
+++ b/deps/npm/test/tap/uninstall-save.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
var server
-var pkg = path.join(__dirname, path.basename(__filename, '.js'))
+var pkg = common.pkg
var EXEC_OPTS = { cwd: pkg, stdio: [0, 'ignore', 2] }
diff --git a/deps/npm/test/tap/unpack-foreign-tarball.js b/deps/npm/test/tap/unpack-foreign-tarball.js
index d128e94d8c..a1649c24bd 100644
--- a/deps/npm/test/tap/unpack-foreign-tarball.js
+++ b/deps/npm/test/tap/unpack-foreign-tarball.js
@@ -10,7 +10,7 @@ var common = require('../common-tap.js')
var fixtures = path.resolve(__dirname, '..', 'fixtures')
-var pkg = path.resolve(__dirname, 'unpack-foreign-tarball')
+var pkg = common.pkg
var nm = path.resolve(pkg, 'node_modules')
var target = path.resolve(nm, 'npm-test-gitignore')
var cache = path.resolve(pkg, 'cache')
diff --git a/deps/npm/test/tap/unpublish-config.js b/deps/npm/test/tap/unpublish-config.js
index f5d391d8c2..f358835561 100644
--- a/deps/npm/test/tap/unpublish-config.js
+++ b/deps/npm/test/tap/unpublish-config.js
@@ -7,10 +7,9 @@ var osenv = require('osenv')
var rimraf = require('rimraf')
var test = require('tap').test
-var pkg = path.join(__dirname, 'npm-test-unpublish-config')
-var fixturePath = path.join(pkg, 'fixture_npmrc')
-
var common = require('../common-tap.js')
+var pkg = common.pkg
+var fixturePath = path.join(pkg, 'fixture_npmrc')
var json = {
name: 'npm-test-unpublish-config',
@@ -27,7 +26,7 @@ test('setup', function (t) {
)
fs.writeFileSync(
fixturePath,
- '//localhost:1337/:_authToken = beeeeeeeeeeeeef\n' +
+ '//localhost:' + common.port + '/:_authToken = beeeeeeeeeeeeef\n' +
'registry = http://lvh.me:4321/registry/path\n'
)
diff --git a/deps/npm/test/tap/unsupported.js b/deps/npm/test/tap/unsupported.js
index 7abc8da741..deae8d3c03 100644
--- a/deps/npm/test/tap/unsupported.js
+++ b/deps/npm/test/tap/unsupported.js
@@ -21,8 +21,8 @@ var versions = [
['v2.3.1', true, true],
['v3.0.0', true, true],
['v4.5.0', true, true],
- ['v4.8.4', false, true],
- ['v5.7.1', false, true],
+ ['v4.8.4', true, true],
+ ['v5.7.1', true, true],
['v6.8.1', false, false],
['v7.0.0-beta23', false, true],
['v7.2.3', false, true],
diff --git a/deps/npm/test/tap/update-examples.js b/deps/npm/test/tap/update-examples.js
index 8369d002fa..f0a7a6271d 100644
--- a/deps/npm/test/tap/update-examples.js
+++ b/deps/npm/test/tap/update-examples.js
@@ -9,7 +9,7 @@ var osenv = require('osenv')
var requireInject = require('require-inject')
-var PKG_DIR = path.resolve(__dirname, 'update-examples')
+var PKG_DIR = common.pkg
var CACHE_DIR = path.resolve(PKG_DIR, 'cache')
// ** constant templates for mocks **
diff --git a/deps/npm/test/tap/update-symlink.js b/deps/npm/test/tap/update-symlink.js
index 79139d306f..a21a68267b 100644
--- a/deps/npm/test/tap/update-symlink.js
+++ b/deps/npm/test/tap/update-symlink.js
@@ -8,7 +8,7 @@ const Symlink = Tacks.Symlink
const Dir = Tacks.Dir
const common = require('../common-tap.js')
-const basedir = path.join(__dirname, path.basename(__filename, '.js'))
+const basedir = common.pkg
const testdir = path.join(basedir, 'testdir')
const cachedir = path.join(basedir, 'cache')
const globaldir = path.join(basedir, 'global')
diff --git a/deps/npm/test/tap/upgrade-lifecycles.js b/deps/npm/test/tap/upgrade-lifecycles.js
index 0d0b8da616..3adea06d71 100644
--- a/deps/npm/test/tap/upgrade-lifecycles.js
+++ b/deps/npm/test/tap/upgrade-lifecycles.js
@@ -6,7 +6,7 @@ var File = Tacks.File
var Dir = Tacks.Dir
var common = require('../common-tap.js')
-var basedir = path.join(__dirname, path.basename(__filename, '.js'))
+var basedir = common.pkg
var testdir = path.join(basedir, 'testdir')
var cachedir = path.join(basedir, 'cache')
var globaldir = path.join(basedir, 'global')
diff --git a/deps/npm/test/tap/url-dependencies.js b/deps/npm/test/tap/url-dependencies.js
index 66b3e1a63b..2017151568 100644
--- a/deps/npm/test/tap/url-dependencies.js
+++ b/deps/npm/test/tap/url-dependencies.js
@@ -10,7 +10,7 @@ var test = require('tap').test
var common = require('../common-tap')
var server
-var pkg = path.resolve(__dirname, 'url-dependencies')
+var pkg = common.pkg
var json = {
author: 'Steve Mason',
diff --git a/deps/npm/test/tap/verify-no-lifecycle-on-repo.js b/deps/npm/test/tap/verify-no-lifecycle-on-repo.js
index babdfb7dac..c9232715a7 100644
--- a/deps/npm/test/tap/verify-no-lifecycle-on-repo.js
+++ b/deps/npm/test/tap/verify-no-lifecycle-on-repo.js
@@ -5,9 +5,9 @@ var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
var test = require('tap').test
var requireInject = require('require-inject')
-require('../common-tap.js')
+const common = require('../common-tap.js')
-var base = path.join(__dirname, path.basename(__filename, '.js'))
+var base = common.pkg
var baseJSON = {
name: 'base',
diff --git a/deps/npm/test/tap/version-allow-same-version.js b/deps/npm/test/tap/version-allow-same-version.js
index 66f568dec9..fdd68032bc 100644
--- a/deps/npm/test/tap/version-allow-same-version.js
+++ b/deps/npm/test/tap/version-allow-same-version.js
@@ -8,7 +8,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
var npm = require('../../')
-var pkg = path.resolve(__dirname, 'version-allow-same-version')
+var pkg = common.pkg
var cache = path.resolve(pkg, 'cache')
var npmrc = path.resolve(pkg, './.npmrc')
var configContents = 'sign-git-tag=false\n'
diff --git a/deps/npm/test/tap/version-commit-hooks.js b/deps/npm/test/tap/version-commit-hooks.js
index 4791fc3f3c..568c82b46b 100644
--- a/deps/npm/test/tap/version-commit-hooks.js
+++ b/deps/npm/test/tap/version-commit-hooks.js
@@ -3,7 +3,8 @@ var path = require('path')
var osenv = require('osenv')
var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
-var pkg = path.resolve(__dirname, 'version-commit-hooks')
+const common = require('../common-tap.js')
+var pkg = common.pkg
var test = require('tap').test
var npm = require('../../')
diff --git a/deps/npm/test/tap/version-consistent-newlines.js b/deps/npm/test/tap/version-consistent-newlines.js
index 11020b2a70..56b16afcf4 100644
--- a/deps/npm/test/tap/version-consistent-newlines.js
+++ b/deps/npm/test/tap/version-consistent-newlines.js
@@ -10,7 +10,7 @@ const mkdirp = require('mkdirp')
const rimraf = require('rimraf')
const requireInject = require('require-inject')
-const pkg = path.resolve(__dirname, 'version-no-git')
+const pkg = common.pkg
const cache = path.resolve(pkg, 'cache')
const gitDir = path.resolve(pkg, '.git')
diff --git a/deps/npm/test/tap/version-from-git.js b/deps/npm/test/tap/version-from-git.js
index 1dc649beb4..759396a782 100644
--- a/deps/npm/test/tap/version-from-git.js
+++ b/deps/npm/test/tap/version-from-git.js
@@ -9,7 +9,7 @@ var test = require('tap').test
var npm = require('../../lib/npm.js')
-var pkg = path.resolve(__dirname, 'version-from-git')
+var pkg = common.pkg
var packagePath = path.resolve(pkg, 'package.json')
var cache = path.resolve(pkg, 'cache')
diff --git a/deps/npm/test/tap/version-git-not-clean.js b/deps/npm/test/tap/version-git-not-clean.js
index 43e2549ceb..b387c00e64 100644
--- a/deps/npm/test/tap/version-git-not-clean.js
+++ b/deps/npm/test/tap/version-git-not-clean.js
@@ -9,7 +9,7 @@ var mkdirp = require('mkdirp')
var which = require('which')
var spawn = require('child_process').spawn
-var pkg = path.resolve(__dirname, 'version-git-not-clean')
+var pkg = common.pkg
var cache = path.resolve(pkg, 'cache')
test('npm version <semver> with working directory not clean', function (t) {
diff --git a/deps/npm/test/tap/version-lifecycle.js b/deps/npm/test/tap/version-lifecycle.js
index e7a7793b44..98c96b6826 100644
--- a/deps/npm/test/tap/version-lifecycle.js
+++ b/deps/npm/test/tap/version-lifecycle.js
@@ -8,7 +8,7 @@ var test = require('tap').test
var common = require('../common-tap.js')
var npm = require('../../')
-var pkg = path.resolve(__dirname, 'version-lifecycle')
+var pkg = common.pkg
var cache = path.resolve(pkg, 'cache')
var npmrc = path.resolve(pkg, './.npmrc')
var configContents = 'sign-git-commit=false\nsign-git-tag=false\n'
diff --git a/deps/npm/test/tap/version-message-config.js b/deps/npm/test/tap/version-message-config.js
index 12cb6eb599..db45809879 100644
--- a/deps/npm/test/tap/version-message-config.js
+++ b/deps/npm/test/tap/version-message-config.js
@@ -9,7 +9,7 @@ var test = require('tap').test
var npm = require('../../lib/npm.js')
-var pkg = path.resolve(__dirname, 'version-message-config')
+var pkg = common.pkg
var cache = path.resolve(pkg, 'cache')
var npmrc = path.resolve(pkg, '.npmrc')
var packagePath = path.resolve(pkg, 'package.json')
diff --git a/deps/npm/test/tap/version-no-git.js b/deps/npm/test/tap/version-no-git.js
index 0a859c7af2..dc1ee05662 100644
--- a/deps/npm/test/tap/version-no-git.js
+++ b/deps/npm/test/tap/version-no-git.js
@@ -8,7 +8,7 @@ var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
var requireInject = require('require-inject')
-var pkg = path.resolve(__dirname, 'version-no-git')
+var pkg = common.pkg
var cache = path.resolve(pkg, 'cache')
var gitDir = path.resolve(pkg, '.git')
diff --git a/deps/npm/test/tap/version-no-package.js b/deps/npm/test/tap/version-no-package.js
index e4eeda0eeb..1b16c9f758 100644
--- a/deps/npm/test/tap/version-no-package.js
+++ b/deps/npm/test/tap/version-no-package.js
@@ -1,11 +1,10 @@
var common = require('../common-tap.js')
var test = require('tap').test
var osenv = require('osenv')
-var path = require('path')
var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
-var pkg = path.resolve(__dirname, 'version-no-package')
+var pkg = common.pkg
test('setup', function (t) {
setup()
diff --git a/deps/npm/test/tap/version-no-tags.js b/deps/npm/test/tap/version-no-tags.js
index 755e640c0b..9e7b08c61f 100644
--- a/deps/npm/test/tap/version-no-tags.js
+++ b/deps/npm/test/tap/version-no-tags.js
@@ -9,7 +9,7 @@ var mkdirp = require('mkdirp')
var which = require('which')
var spawn = require('child_process').spawn
-var pkg = path.resolve(__dirname, 'version-no-tags')
+var pkg = common.pkg
var cache = path.resolve(pkg, 'cache')
test('npm version <semver> without git tag', function (t) {
diff --git a/deps/npm/test/tap/version-prerelease-id.js b/deps/npm/test/tap/version-prerelease-id.js
index 1a206aa116..5e342667cd 100644
--- a/deps/npm/test/tap/version-prerelease-id.js
+++ b/deps/npm/test/tap/version-prerelease-id.js
@@ -9,7 +9,7 @@ var test = require('tap').test
var npm = require('../../')
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'version-shrinkwrap')
+var pkg = common.pkg
var cache = path.resolve(pkg, 'cache')
var EXEC_OPTS = { cwd: pkg }
diff --git a/deps/npm/test/tap/version-sub-directory-shrinkwrap.js b/deps/npm/test/tap/version-sub-directory-shrinkwrap.js
index 0455b62ab7..c6e607d7c5 100644
--- a/deps/npm/test/tap/version-sub-directory-shrinkwrap.js
+++ b/deps/npm/test/tap/version-sub-directory-shrinkwrap.js
@@ -9,7 +9,7 @@ var test = require('tap').test
var npm = require('../../lib/npm.js')
-var pkg = path.resolve(__dirname, 'version-sub-directory')
+var pkg = common.pkg
var subDirectory = path.resolve(pkg, 'sub-directory')
var packagePath = path.resolve(pkg, 'package.json')
var shrinkwrapPath = path.resolve(pkg, 'npm-shrinkwrap.json')
diff --git a/deps/npm/test/tap/version-sub-directory.js b/deps/npm/test/tap/version-sub-directory.js
index 71c96121ca..a7eb8f1042 100644
--- a/deps/npm/test/tap/version-sub-directory.js
+++ b/deps/npm/test/tap/version-sub-directory.js
@@ -9,7 +9,7 @@ var test = require('tap').test
var npm = require('../../lib/npm.js')
-var pkg = path.resolve(__dirname, 'version-sub-directory')
+var pkg = common.pkg
var subDirectory = path.resolve(pkg, 'sub-directory')
var packagePath = path.resolve(pkg, 'package.json')
var cache = path.resolve(pkg, 'cache')
diff --git a/deps/npm/test/tap/version-update-shrinkwrap.js b/deps/npm/test/tap/version-update-shrinkwrap.js
index 58264e9926..47822f646e 100644
--- a/deps/npm/test/tap/version-update-shrinkwrap.js
+++ b/deps/npm/test/tap/version-update-shrinkwrap.js
@@ -9,7 +9,7 @@ var test = require('tap').test
var npm = require('../../')
var common = require('../common-tap.js')
-var pkg = path.resolve(__dirname, 'version-shrinkwrap')
+var pkg = common.pkg
var cache = path.resolve(pkg, 'cache')
test('npm version <semver> updates shrinkwrap - no git', function (t) {