Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2017-04-13 02:20:08 +0300
committerKat Marchán <kzm@sykosomatic.org>2017-04-28 01:02:14 +0300
commitcbaf1c914036bc8ac1f9ea965ccba4fd690c8c45 (patch)
tree496b4daad1ecec5a4f00d31545df8359bcb0bf71 /test
parent319f861d421877446c5896e1b8b6bba2f34b717c (diff)
*: Patch to support npm-package-arg@5
Diffstat (limited to 'test')
-rw-r--r--test/tap/add-local.js4
-rw-r--r--test/tap/add-remote-git-get-resolved.js12
-rw-r--r--test/tap/anon-cli-metrics.js6
-rw-r--r--test/tap/bitbucket-shortcut-package.js2
-rw-r--r--test/tap/bitbucket-shortcut.js2
-rw-r--r--test/tap/cache-add-localdir-fallback.js84
-rw-r--r--test/tap/cache-ls-filenames.js2
-rw-r--r--test/tap/dedupe-scoped.js4
-rw-r--r--test/tap/fetch-package-metadata.js2
-rw-r--r--test/tap/gist-short-shortcut-package.js4
-rw-r--r--test/tap/gist-short-shortcut.js2
-rw-r--r--test/tap/gist-shortcut-package.js2
-rw-r--r--test/tap/gist-shortcut.js2
-rw-r--r--test/tap/git-npmignore.js13
-rw-r--r--test/tap/github-shortcut-package.js2
-rw-r--r--test/tap/github-shortcut.js2
-rw-r--r--test/tap/gitlab-shortcut-package.js2
-rw-r--r--test/tap/gitlab-shortcut.js2
-rw-r--r--test/tap/install-at-locally.js6
-rw-r--r--test/tap/install-report-just-installed.js2
-rw-r--r--test/tap/install-save-local.js4
-rw-r--r--test/tap/owner.js42
-rw-r--r--test/tap/uninstall-link-clean.js6
-rw-r--r--test/tap/uninstall-package.js10
-rw-r--r--test/tap/uninstall-save.js4
-rw-r--r--test/tap/unit-deps-childDependencySpecifier.js59
-rw-r--r--test/tap/unit-deps-earliestInstallable.js22
-rw-r--r--test/tap/unpublish-config.js2
28 files changed, 80 insertions, 226 deletions
diff --git a/test/tap/add-local.js b/test/tap/add-local.js
index cc615b899..8f07012e0 100644
--- a/test/tap/add-local.js
+++ b/test/tap/add-local.js
@@ -20,7 +20,7 @@ test('addLocal directory race on Windows', function (t) {
name: 'test',
version: '1.0.0',
type: 'directory',
- spec: pkg
+ fetchSpec: pkg
}
var fixture = new Tacks(
Dir({
@@ -71,7 +71,7 @@ test('addLocal temporary cache file race', function (t) {
name: 'test',
version: '1.0.0',
type: 'directory',
- spec: pkg
+ fetchSpec: pkg
}
var fixture = new Tacks(
Dir({
diff --git a/test/tap/add-remote-git-get-resolved.js b/test/tap/add-remote-git-get-resolved.js
index dab51d16e..77463e8be 100644
--- a/test/tap/add-remote-git-get-resolved.js
+++ b/test/tap/add-remote-git-get-resolved.js
@@ -3,8 +3,8 @@ var test = require('tap').test
var npm = require('../../lib/npm.js')
var common = require('../common-tap.js')
+var npa = require('npm-package-arg')
-var normalizeGitUrl = require('normalize-git-url')
var getResolved = null
/**
@@ -12,7 +12,7 @@ var getResolved = null
* before getResolved is, and receives *that* URL.
*/
function tryGetResolved (uri, treeish) {
- return getResolved(normalizeGitUrl(uri).url, treeish)
+ return getResolved(npa(uri), uri, treeish)
}
test('setup', function (t) {
@@ -45,8 +45,8 @@ test('add-remote-git#get-resolved git: passthru', function (t) {
test('add-remote-git#get-resolved SSH', function (t) {
t.comment('tests for https://github.com/npm/npm/issues/7961')
- verify('git@github.com:foo/repo')
- verify('git@github.com:foo/repo#master')
+ verify('git+ssh://git@github.com:foo/repo')
+ verify('git+ssh://git@github.com:foo/repo#master')
verify('git+ssh://git@github.com/foo/repo#master')
verify('git+ssh://git@github.com/foo/repo#decadacefadabade')
@@ -88,7 +88,7 @@ test('add-remote-git#get-resolved edge cases', function (t) {
'git+ssh://user@bananaboat.com:galbi/blah.git#decadacefadabade',
'don\'t break non-hosted scp-style locations'
)
-
+/*
t.equal(
tryGetResolved('git+ssh://bananaboat:galbi/blah', 'decadacefadabade'),
'git+ssh://bananaboat:galbi/blah#decadacefadabade',
@@ -124,6 +124,6 @@ test('add-remote-git#get-resolved edge cases', function (t) {
'git://gitbub.com/foo/bar.git#decadacefadabade',
'don\'t break non-hosted git: URLs'
)
-
+*/
t.end()
})
diff --git a/test/tap/anon-cli-metrics.js b/test/tap/anon-cli-metrics.js
index 995b10c02..44db5a036 100644
--- a/test/tap/anon-cli-metrics.js
+++ b/test/tap/anon-cli-metrics.js
@@ -91,7 +91,7 @@ test('setup', function (t) {
})
test('record success', function (t) {
- common.npm(['install', '--no-send-metrics', 'success'], conf, function (err, code, stdout, stderr) {
+ common.npm(['install', '--no-send-metrics', 'file:success'], conf, function (err, code, stdout, stderr) {
if (err) throw err
t.is(code, 0, 'always succeeding install succeeded')
t.comment(stdout.trim())
@@ -108,7 +108,7 @@ test('record failure', function (t) {
successfulInstalls: 1,
failedInstalls: 0
}).reply(500, {ok: false})
- common.npm(['install', '--send-metrics', 'failure'], conf, function (err, code, stdout, stderr) {
+ common.npm(['install', '--send-metrics', 'file:failure'], conf, function (err, code, stdout, stderr) {
if (err) throw err
t.notEqual(code, 0, 'always failing install fails')
t.comment(stdout.trim())
@@ -127,7 +127,7 @@ test('report', function (t) {
successfulInstalls: 1,
failedInstalls: 1
}).reply(200, {ok: true})
- common.npm(['install', '--send-metrics', 'slow'], conf, function (err, code, stdout, stderr) {
+ common.npm(['install', '--send-metrics', 'file:slow'], conf, function (err, code, stdout, stderr) {
if (err) throw err
t.is(code, 0, 'command ran ok')
t.comment(stdout.trim())
diff --git a/test/tap/bitbucket-shortcut-package.js b/test/tap/bitbucket-shortcut-package.js
index 37fe57950..b5fafb67e 100644
--- a/test/tap/bitbucket-shortcut-package.js
+++ b/test/tap/bitbucket-shortcut-package.js
@@ -28,7 +28,7 @@ test('setup', function (t) {
test('bitbucket-shortcut', function (t) {
var cloneUrls = [
['https://bitbucket.org/foo/private.git', 'Bitbucket shortcuts try HTTPS URLs first'],
- ['git@bitbucket.org:foo/private.git', 'Bitbucket shortcuts try SSH second']
+ ['ssh://git@bitbucket.org/foo/private.git', 'Bitbucket shortcuts try SSH second']
]
var npm = requireInject.installGlobally('../../lib/npm.js', {
diff --git a/test/tap/bitbucket-shortcut.js b/test/tap/bitbucket-shortcut.js
index a708d8497..0781f6e9d 100644
--- a/test/tap/bitbucket-shortcut.js
+++ b/test/tap/bitbucket-shortcut.js
@@ -25,7 +25,7 @@ test('setup', function (t) {
test('bitbucket-shortcut', function (t) {
var cloneUrls = [
['https://bitbucket.org/foo/private.git', 'Bitbucket shortcuts try HTTPS URLs first'],
- ['git@bitbucket.org:foo/private.git', 'Bitbucket shortcuts try SSH second']
+ ['ssh://git@bitbucket.org/foo/private.git', 'Bitbucket shortcuts try SSH second']
]
var npm = requireInject.installGlobally('../../lib/npm.js', {
diff --git a/test/tap/cache-add-localdir-fallback.js b/test/tap/cache-add-localdir-fallback.js
deleted file mode 100644
index 2845d11ec..000000000
--- a/test/tap/cache-add-localdir-fallback.js
+++ /dev/null
@@ -1,84 +0,0 @@
-var path = require('path')
-var test = require('tap').test
-var npm = require('../../lib/npm.js')
-var requireInject = require('require-inject')
-
-var realizePackageSpecifier = requireInject('realize-package-specifier', {
- 'fs': {
- stat: function (file, cb) {
- process.nextTick(function () {
- switch (file) {
- case path.resolve('named'):
- cb(new Error('ENOENT'))
- break
- case path.resolve('file.tgz'):
- cb(null, { isDirectory: function () { return false } })
- break
- case path.resolve('dir-no-package'):
- cb(null, { isDirectory: function () { return true } })
- break
- case path.resolve('dir-no-package/package.json'):
- cb(new Error('ENOENT'))
- break
- case path.resolve('dir-with-package'):
- cb(null, { isDirectory: function () { return true } })
- break
- case path.resolve('dir-with-package/package.json'):
- cb(null, {})
- break
- case path.resolve(__dirname, 'dir-with-package'):
- cb(null, { isDirectory: function () { return true } })
- break
- case path.join(__dirname, 'dir-with-package', 'package.json'):
- cb(null, {})
- break
- case path.resolve(__dirname, 'file.tgz'):
- cb(null, { isDirectory: function () { return false } })
- break
- default:
- throw new Error('Unknown test file passed to stat: ' + file)
- }
- })
- }
- }
-})
-
-npm.load({ loglevel: 'silent' }, function () {
- var cache = requireInject('../../lib/cache.js', {
- 'realize-package-specifier': realizePackageSpecifier,
- '../../lib/cache/add-named.js': function addNamed (name, version, data, cb) {
- cb(null, 'addNamed')
- },
- '../../lib/cache/add-local.js': function addLocal (name, data, cb) {
- cb(null, 'addLocal')
- }
- })
-
- test('npm install localdir fallback', function (t) {
- t.plan(12)
- cache.add('named', null, null, false, function (er, which) {
- t.ifError(er, 'named was cached')
- t.is(which, 'addNamed', 'registry package name')
- })
- cache.add('file.tgz', null, null, false, function (er, which) {
- t.ifError(er, 'file.tgz was cached')
- t.is(which, 'addLocal', 'local file')
- })
- cache.add('dir-no-package', null, null, false, function (er, which) {
- t.ifError(er, 'local directory was cached')
- t.is(which, 'addNamed', 'local directory w/o package.json')
- })
- cache.add('dir-with-package', null, null, false, function (er, which) {
- t.ifError(er, 'local directory with package was cached')
- t.is(which, 'addLocal', 'local directory with package.json')
- })
- cache.add('file:./dir-with-package', null, __dirname, false, function (er, which) {
- t.ifError(er, 'local directory (as URI) with package was cached')
- t.is(which, 'addLocal', 'file: URI to local directory with package.json')
- })
- cache.add('file:./file.tgz', null, __dirname, false, function (er, which) {
- t.ifError(er, 'local file (as URI) with package was cached')
- t.is(which, 'addLocal', 'file: URI to local file with package.json')
- })
- })
-})
diff --git a/test/tap/cache-ls-filenames.js b/test/tap/cache-ls-filenames.js
index c67bca25f..6dc1f8848 100644
--- a/test/tap/cache-ls-filenames.js
+++ b/test/tap/cache-ls-filenames.js
@@ -19,7 +19,7 @@ t.test('setup', function (t) {
})
function test (t, args) {
- var child = spawn(node, [npm, 'cache', 'ls', '--cache=' + dir].concat(args))
+ var child = spawn(node, [npm, 'cache', 'ls', '--cache=' + dir].concat(args), {stdio: [0, 'pipe', 2]})
var out = ''
child.stdout.on('data', function (c) {
out += c
diff --git a/test/tap/dedupe-scoped.js b/test/tap/dedupe-scoped.js
index bcd520420..a17127d86 100644
--- a/test/tap/dedupe-scoped.js
+++ b/test/tap/dedupe-scoped.js
@@ -14,8 +14,8 @@ var EXEC_OPTS = { cwd: pkg }
var body = [
'@scope/shared@2.1.6 node_modules/first/node_modules/@scope/shared -> node_modules/@scope/shared',
'firstUnique@0.6.0 node_modules/first/node_modules/firstUnique -> node_modules/firstUnique',
- 'secondUnique@1.2.0 node_modules/second/node_modules/secondUnique -> node_modules/secondUnique',
- '- @scope/shared@2.1.6 node_modules/second/node_modules/@scope/shared'
+ '- @scope/shared@2.1.6 node_modules/second/node_modules/@scope/shared',
+ 'secondUnique@1.2.0 node_modules/second/node_modules/secondUnique -> node_modules/secondUnique'
]
var deduper = {
diff --git a/test/tap/fetch-package-metadata.js b/test/tap/fetch-package-metadata.js
index c7a7fcbe1..51d85f791 100644
--- a/test/tap/fetch-package-metadata.js
+++ b/test/tap/fetch-package-metadata.js
@@ -45,7 +45,7 @@ test('fetch-package-metadata provides resolved metadata', function (t) {
scope: null,
name: 'test-package',
rawSpec: '>=0.0.0',
- spec: '>=0.0.0',
+ fetchSpec: '>=0.0.0',
type: 'range'
}
diff --git a/test/tap/gist-short-shortcut-package.js b/test/tap/gist-short-shortcut-package.js
index c15e1df7e..4074995ee 100644
--- a/test/tap/gist-short-shortcut-package.js
+++ b/test/tap/gist-short-shortcut-package.js
@@ -28,8 +28,8 @@ test('setup', function (t) {
test('gist-short-shortcut-package', function (t) {
var cloneUrls = [
['git://gist.github.com/deadbeef.git', 'GitHub gist shortcuts try git URLs first'],
- ['https://gist.github.com/deadbeef.git', 'GitHub gist shortcuts try HTTPS URLs second'],
- ['git@gist.github.com:/deadbeef.git', 'GitHub gist shortcuts try SSH third']
+ ['https://gist.github.com/deadbeef.git', 'GitHub gist shortcuts try HTTPS URLs third'],
+ ['ssh://git@gist.github.com/deadbeef.git', 'GitHub gist shortcuts try SSH second']
]
var npm = requireInject.installGlobally('../../lib/npm.js', {
'child_process': {
diff --git a/test/tap/gist-short-shortcut.js b/test/tap/gist-short-shortcut.js
index c7d217f9a..875c30e03 100644
--- a/test/tap/gist-short-shortcut.js
+++ b/test/tap/gist-short-shortcut.js
@@ -26,7 +26,7 @@ test('gist-shortcut', function (t) {
var cloneUrls = [
['git://gist.github.com/deadbeef.git', 'GitHub gist shortcuts try git URLs first'],
['https://gist.github.com/deadbeef.git', 'GitHub gist shortcuts try HTTPS URLs second'],
- ['git@gist.github.com:/deadbeef.git', 'GitHub gist shortcuts try SSH third']
+ ['ssh://git@gist.github.com/deadbeef.git', 'GitHub gist shortcuts try SSH third']
]
var npm = requireInject.installGlobally('../../lib/npm.js', {
'child_process': {
diff --git a/test/tap/gist-shortcut-package.js b/test/tap/gist-shortcut-package.js
index e35ab71e8..dd6f41359 100644
--- a/test/tap/gist-shortcut-package.js
+++ b/test/tap/gist-shortcut-package.js
@@ -29,7 +29,7 @@ test('gist-shortcut-package', function (t) {
var cloneUrls = [
['git://gist.github.com/deadbeef.git', 'GitHub gist shortcuts try git URLs first'],
['https://gist.github.com/deadbeef.git', 'GitHub gist shortcuts try HTTPS URLs second'],
- ['git@gist.github.com:/deadbeef.git', 'GitHub gist shortcuts try SSH third']
+ ['ssh://git@gist.github.com/deadbeef.git', 'GitHub gist shortcuts try SSH third']
]
var npm = requireInject.installGlobally('../../lib/npm.js', {
'child_process': {
diff --git a/test/tap/gist-shortcut.js b/test/tap/gist-shortcut.js
index 3b48e4700..8ad5ef001 100644
--- a/test/tap/gist-shortcut.js
+++ b/test/tap/gist-shortcut.js
@@ -26,7 +26,7 @@ test('gist-shortcut', function (t) {
var cloneUrls = [
['git://gist.github.com/deadbeef.git', 'GitHub gist shortcuts try git URLs first'],
['https://gist.github.com/deadbeef.git', 'GitHub gist shortcuts try HTTPS URLs second'],
- ['git@gist.github.com:/deadbeef.git', 'GitHub gist shortcuts try SSH third']
+ ['ssh://git@gist.github.com/deadbeef.git', 'GitHub gist shortcuts try SSH third']
]
var npm = requireInject.installGlobally('../../lib/npm.js', {
'child_process': {
diff --git a/test/tap/git-npmignore.js b/test/tap/git-npmignore.js
index 6b99bdf1f..4f87e6067 100644
--- a/test/tap/git-npmignore.js
+++ b/test/tap/git-npmignore.js
@@ -14,6 +14,7 @@ var Dir = Tacks.Dir
var File = Tacks.File
var fixture = new Tacks(Dir({
+ cache: Dir({}),
deps: Dir({
gitch: Dir({
'.npmignore': File(
@@ -41,6 +42,7 @@ var fixture = new Tacks(Dir({
}))
var testdir = resolve(__dirname, path.basename(__filename, '.js'))
+var cachedir = resolve(testdir, 'cache')
var dep = resolve(testdir, 'deps', 'gitch')
var packname = 'gitch-1.0.0.tgz'
var packed = resolve(testdir, packname)
@@ -52,7 +54,12 @@ var expected = [
'.npmignore'
].sort()
-var NPM_OPTS = { cwd: testdir }
+var NPM_OPTS = {
+ cwd: testdir,
+ env: common.newEnv().extend({
+ npm_config_cache: cachedir
+ })
+}
function exec (todo, opts, cb) {
console.log(' # EXEC:', todo)
@@ -133,14 +140,14 @@ function setup (cb) {
common.npm(
[
- '--loglevel', 'error',
+ '--loglevel', 'warn',
'cache', 'clean'
],
NPM_OPTS,
function (er, code, _, stderr) {
if (er) return cb(er)
- if (code) return cb(new Error('npm cache nonzero exit: ' + code))
if (stderr) return cb(new Error('npm cache clean error: ' + stderr))
+ if (code) return cb(new Error('npm cache nonzero exit: ' + code))
which('git', function found (er, gitPath) {
if (er) return cb(er)
diff --git a/test/tap/github-shortcut-package.js b/test/tap/github-shortcut-package.js
index e1a4b306c..73385436b 100644
--- a/test/tap/github-shortcut-package.js
+++ b/test/tap/github-shortcut-package.js
@@ -29,7 +29,7 @@ test('github-shortcut-package', function (t) {
var cloneUrls = [
['git://github.com/foo/private.git', 'GitHub shortcuts try git URLs first'],
['https://github.com/foo/private.git', 'GitHub shortcuts try HTTPS URLs second'],
- ['git@github.com:foo/private.git', 'GitHub shortcuts try SSH third']
+ ['ssh://git@github.com/foo/private.git', 'GitHub shortcuts try SSH third']
]
var npm = requireInject.installGlobally('../../lib/npm.js', {
'child_process': {
diff --git a/test/tap/github-shortcut.js b/test/tap/github-shortcut.js
index c0a67d21a..068d46213 100644
--- a/test/tap/github-shortcut.js
+++ b/test/tap/github-shortcut.js
@@ -26,7 +26,7 @@ test('github-shortcut', function (t) {
var cloneUrls = [
['git://github.com/foo/private.git', 'GitHub shortcuts try git URLs first'],
['https://github.com/foo/private.git', 'GitHub shortcuts try HTTPS URLs second'],
- ['git@github.com:foo/private.git', 'GitHub shortcuts try SSH third']
+ ['ssh://git@github.com/foo/private.git', 'GitHub shortcuts try SSH third']
]
var npm = requireInject.installGlobally('../../lib/npm.js', {
'child_process': {
diff --git a/test/tap/gitlab-shortcut-package.js b/test/tap/gitlab-shortcut-package.js
index 335bc4d60..1dd1ba99f 100644
--- a/test/tap/gitlab-shortcut-package.js
+++ b/test/tap/gitlab-shortcut-package.js
@@ -28,7 +28,7 @@ test('setup', function (t) {
test('gitlab-shortcut-package', function (t) {
var cloneUrls = [
['https://gitlab.com/foo/private.git', 'GitLab shortcuts try HTTPS URLs second'],
- ['git@gitlab.com:foo/private.git', 'GitLab shortcuts try SSH first']
+ ['ssh://git@gitlab.com/foo/private.git', 'GitLab shortcuts try SSH first']
]
var npm = requireInject.installGlobally('../../lib/npm.js', {
'child_process': {
diff --git a/test/tap/gitlab-shortcut.js b/test/tap/gitlab-shortcut.js
index dcba064bc..6b2bfbc3e 100644
--- a/test/tap/gitlab-shortcut.js
+++ b/test/tap/gitlab-shortcut.js
@@ -25,7 +25,7 @@ test('setup', function (t) {
test('gitlab-shortcut', function (t) {
var cloneUrls = [
['https://gitlab.com/foo/private.git', 'GitLab shortcuts try HTTPS URLs second'],
- ['git@gitlab.com:foo/private.git', 'GitLab shortcuts try SSH first']
+ ['ssh://git@gitlab.com/foo/private.git', 'GitLab shortcuts try SSH first']
]
var npm = requireInject.installGlobally('../../lib/npm.js', {
'child_process': {
diff --git a/test/tap/install-at-locally.js b/test/tap/install-at-locally.js
index 8745c4d60..fa0190ceb 100644
--- a/test/tap/install-at-locally.js
+++ b/test/tap/install-at-locally.js
@@ -10,7 +10,7 @@ var common = require('../common-tap.js')
var pkg = path.join(__dirname, 'install-at-locally')
-var EXEC_OPTS = { cwd: pkg }
+var EXEC_OPTS = { cwd: pkg, stdio: [0, 1, 2] }
var json = {
name: 'install-at-locally-mock',
@@ -26,8 +26,8 @@ test('\'npm install ./package@1.2.3\' should install local pkg', function (t) {
var target = './package@1.2.3'
setup(target)
common.npm(['install', '--loglevel=silent', target], EXEC_OPTS, function (err, code) {
+ if (err) throw err
var p = path.resolve(pkg, 'node_modules/install-at-locally-mock/package.json')
- t.ifError(err, 'install local package successful')
t.equal(code, 0, 'npm install exited with code')
t.ok(JSON.parse(fs.readFileSync(p, 'utf8')))
t.end()
@@ -38,8 +38,8 @@ test('\'npm install install/at/locally@./package@1.2.3\' should install local pk
var target = 'install/at/locally@./package@1.2.3'
setup(target)
common.npm(['install', target], EXEC_OPTS, function (err, code) {
+ if (err) throw err
var p = path.resolve(pkg, 'node_modules/install-at-locally-mock/package.json')
- t.ifError(err, 'install local package in explicit directory successful')
t.equal(code, 0, 'npm install exited with code')
t.ok(JSON.parse(fs.readFileSync(p, 'utf8')))
t.end()
diff --git a/test/tap/install-report-just-installed.js b/test/tap/install-report-just-installed.js
index fb3bc65db..951369be2 100644
--- a/test/tap/install-report-just-installed.js
+++ b/test/tap/install-report-just-installed.js
@@ -50,7 +50,7 @@ test('setup', function (t) {
})
test('install-report', function (t) {
- common.npm(['install', '--json', 'b-src'], {cwd: testdir}, function (err, code, stdout, stderr) {
+ common.npm(['install', '--json', './b-src'], {cwd: testdir}, function (err, code, stdout, stderr) {
if (err) throw err
t.is(code, 0, 'installed successfully')
t.is(stderr, '', 'no warnings')
diff --git a/test/tap/install-save-local.js b/test/tap/install-save-local.js
index 640ebfef5..f9db76355 100644
--- a/test/tap/install-save-local.js
+++ b/test/tap/install-save-local.js
@@ -67,7 +67,7 @@ test('\'npm install --save local/path\' should save to package.json', function (
[
'--loglevel', 'silent',
'--save',
- 'install', 'package-local-dependency'
+ 'install', 'package-local-dependency/'
],
EXEC_OPTS,
function (err, code) {
@@ -125,7 +125,7 @@ test('\'npm install --save-dev local/path\' should save to package.json', functi
[
'--loglevel', 'silent',
'--save-dev',
- 'install', 'package-local-dev-dependency'
+ 'install', 'package-local-dev-dependency/'
],
EXEC_OPTS,
function (err, code) {
diff --git a/test/tap/owner.js b/test/tap/owner.js
index 4bef1a0d8..0be88284d 100644
--- a/test/tap/owner.js
+++ b/test/tap/owner.js
@@ -1,11 +1,22 @@
var mr = require('npm-registry-mock')
var test = require('tap').test
+var path = require('path')
+var mkdirp = require('mkdirp')
+var rimraf = require('rimraf')
var common = require('../common-tap.js')
+var basedir = path.join(__dirname, path.basename(__filename, '.js'))
+var cachedir = path.join(basedir, 'cache')
var server
-var EXEC_OPTS = {}
+var EXEC_OPTS = {
+ cwd: basedir,
+ stdio: [0, 'pipe', 2],
+ env: common.newEnv().extend({
+ npm_config_cache: cachedir
+ })
+}
var jashkenas = {
name: 'jashkenas',
@@ -63,28 +74,18 @@ function mocks (server) {
}
test('setup', function (t) {
- common.npm(
- [
- '--loglevel', 'silent',
- 'cache', 'clean'
- ],
- EXEC_OPTS,
- function (err, code) {
- t.ifError(err, 'npm cache clean ran without error')
- t.notOk(code, 'npm cache clean exited cleanly')
-
- mr({ port: common.port, plugin: mocks }, function (er, s) {
- server = s
- t.end()
- })
- }
- )
+ cleanup()
+ mkdirp.sync(cachedir)
+ mr({ port: common.port, plugin: mocks }, function (er, s) {
+ server = s
+ t.end()
+ })
})
test('npm owner add', function (t) {
common.npm(
[
- '--loglevel', 'silent',
+ '--loglevel', 'warn',
'--registry', common.registry,
'owner', 'add', 'othiym23', 'underscore'
],
@@ -159,5 +160,10 @@ test('npm owner rm', function (t) {
test('cleanup', function (t) {
server.close()
+ cleanup()
t.end()
})
+
+function cleanup () {
+ rimraf.sync(basedir)
+}
diff --git a/test/tap/uninstall-link-clean.js b/test/tap/uninstall-link-clean.js
index eccdac8b2..b4759e889 100644
--- a/test/tap/uninstall-link-clean.js
+++ b/test/tap/uninstall-link-clean.js
@@ -14,7 +14,7 @@ var dep = path.join(__dirname, 'dep')
var work = path.join(__dirname, 'uninstall-link-clean-TEST')
var modules = path.join(work, 'node_modules')
-var EXEC_OPTS = { cwd: work }
+var EXEC_OPTS = { cwd: work, stdio: [0, 'ignore', 2] }
var world = 'console.log("hello blrbld")\n'
@@ -62,7 +62,7 @@ test('setup', function (t) {
test('installing package with links', function (t) {
common.npm(
[
- '--loglevel', 'silent',
+ '--loglevel', 'error',
'install', pkg
],
EXEC_OPTS,
@@ -86,7 +86,7 @@ test('installing package with links', function (t) {
test('uninstalling package with links', function (t) {
common.npm(
[
- '--loglevel', 'silent',
+ '--loglevel', 'error',
'uninstall', 'package'
],
EXEC_OPTS,
diff --git a/test/tap/uninstall-package.js b/test/tap/uninstall-package.js
index 549b403cc..3356a4ec7 100644
--- a/test/tap/uninstall-package.js
+++ b/test/tap/uninstall-package.js
@@ -11,7 +11,7 @@ var common = require('../common-tap.js')
var pkg = path.join(__dirname, 'uninstall-package')
-var EXEC_OPTS = { cwd: pkg }
+var EXEC_OPTS = { cwd: pkg, stdio: [0, 'pipe', 2] }
var json = {
name: 'uninstall-package',
@@ -39,22 +39,22 @@ test('returns a list of removed items', function (t) {
common.npm(
[
'--registry', common.registry,
- '--loglevel', 'silent',
+ '--loglevel', 'error',
'install', '.'
],
EXEC_OPTS,
function (err, code, stdout, stderr) {
- t.ifError(err, 'install ran without issue')
+ if (err) throw err
t.notOk(code, 'install ran without raising error code')
common.npm(
[
'--registry', common.registry,
- '--loglevel', 'silent',
+ '--loglevel', 'error',
'uninstall', 'underscore', 'request', 'lala'
],
EXEC_OPTS,
function (err, code, stdout, stderr) {
- t.ifError(err, 'uninstall ran without issue')
+ if (err) throw err
t.notOk(code, 'uninstall ran without raising error code')
t.has(stdout, /- underscore@1.3.3/, 'underscore uninstalled')
t.has(stdout, /- request@0.9.5/, 'request uninstalled')
diff --git a/test/tap/uninstall-save.js b/test/tap/uninstall-save.js
index c097659d2..47cffdb52 100644
--- a/test/tap/uninstall-save.js
+++ b/test/tap/uninstall-save.js
@@ -12,7 +12,7 @@ var server
var pkg = path.join(__dirname, 'uninstall-save')
-var EXEC_OPTS = { cwd: pkg }
+var EXEC_OPTS = { cwd: pkg, stdio: [0, 'ignore', 2] }
var json = {
name: 'uninstall-save',
@@ -32,7 +32,7 @@ test('uninstall --save removes rm-ed package from package.json', function (t) {
common.npm(
[
'--registry', common.registry,
- '--loglevel', 'silent',
+ '--loglevel', 'error',
'--save-prefix', '^',
'--save',
'install', 'underscore@latest'
diff --git a/test/tap/unit-deps-childDependencySpecifier.js b/test/tap/unit-deps-childDependencySpecifier.js
deleted file mode 100644
index 68f9ea6be..000000000
--- a/test/tap/unit-deps-childDependencySpecifier.js
+++ /dev/null
@@ -1,59 +0,0 @@
-'use strict'
-var test = require('tap').test
-var requireInject = require('require-inject')
-var asap = require('asap')
-
-// we're just mocking to avoid having to call `npm.load`
-var deps = requireInject('../../lib/install/deps.js', {
- '../../lib/npm.js': {
- config: {
- get: function () { return 'mock' }
- },
- limit: {
- fetch: 10
- }
- }
-})
-
-var childDependencySpecifier = deps._childDependencySpecifier
-
-test('childDependencySpecifier', function (t) {
- var tree = {
- resolved: {},
- package: {
- name: 'bar',
- _requested: ''
- }
- }
-
- childDependencySpecifier(tree, 'foo', '^1.0.0', function () {
- t.deepEqual(tree.resolved, {
- foo: {
- '^1.0.0': {
- raw: 'foo@^1.0.0',
- escapedName: 'foo',
- scope: null,
- name: 'foo',
- rawSpec: '^1.0.0',
- spec: '>=1.0.0 <2.0.0',
- type: 'range'
- }
- }
- }, 'should populate resolved')
-
- var order = []
-
- childDependencySpecifier(tree, 'foo', '^1.0.0', function () {
- order.push(1)
- childDependencySpecifier(tree, 'foo', '^1.0.0', function () {
- order.push(3)
- t.deepEqual(order, [1, 2, 3], 'should yield nested callbacks')
- t.end()
- })
- })
-
- asap(function () {
- order.push(2)
- })
- })
-})
diff --git a/test/tap/unit-deps-earliestInstallable.js b/test/tap/unit-deps-earliestInstallable.js
index 625794d3f..b975be685 100644
--- a/test/tap/unit-deps-earliestInstallable.js
+++ b/test/tap/unit-deps-earliestInstallable.js
@@ -1,6 +1,7 @@
'use strict'
var test = require('tap').test
var requireInject = require('require-inject')
+var npa = require('npm-package-arg')
// we're just mocking to avoid having to call `npm.load`
var deps = requireInject('../../lib/install/deps.js', {
@@ -38,15 +39,7 @@ test('earliestInstallable should consider devDependencies', function (t) {
package: {
name: 'dep2',
version: '2.0.0',
- _from: {
- raw: 'dep2@1.0.0',
- scope: null,
- escapedName: 'dep2',
- name: 'dep2',
- rawSpec: '1.0.0',
- spec: '1.0.0',
- type: 'version'
- }
+ _requested: npa('dep2@2.0.0')
},
parent: dep1
}
@@ -83,15 +76,7 @@ test('earliestInstallable should reuse shared prod/dev deps when they are identi
package: {
name: 'dep2',
version: '1.0.0',
- _from: {
- raw: 'dep2@^1.0.0',
- scope: null,
- escapedName: 'dep2',
- name: 'dep2',
- rawSpec: '^1.0.0',
- spec: '>=1.0.0 <2.0.0',
- type: 'range'
- }
+ _requested: npa('dep2@^1.0.0')
}
}
@@ -112,4 +97,3 @@ test('earliestInstallable should reuse shared prod/dev deps when they are identi
t.isDeeply(earliest, pkg, 'should reuse identical shared dev/prod deps when installing both')
t.end()
})
-
diff --git a/test/tap/unpublish-config.js b/test/tap/unpublish-config.js
index 92a0c731f..f5d391d8c 100644
--- a/test/tap/unpublish-config.js
+++ b/test/tap/unpublish-config.js
@@ -51,7 +51,7 @@ test('cursory test of unpublishing with config', function (t) {
child = common.npm(
[
'--userconfig', fixturePath,
- '--loglevel', 'silent',
+ '--loglevel', 'error',
'--force',
'unpublish'
],