summaryrefslogtreecommitdiff
path: root/deps/npm/test
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/test')
-rw-r--r--deps/npm/test/fixtures/config/userconfig-with-gc2
-rw-r--r--deps/npm/test/tap/deprecate.js24
-rw-r--r--deps/npm/test/tap/link.js45
-rw-r--r--deps/npm/test/tap/outdated-symlink.js27
-rw-r--r--deps/npm/test/tap/search.js14
5 files changed, 101 insertions, 11 deletions
diff --git a/deps/npm/test/fixtures/config/userconfig-with-gc b/deps/npm/test/fixtures/config/userconfig-with-gc
index 7268fcb3c6..62ad80be11 100644
--- a/deps/npm/test/fixtures/config/userconfig-with-gc
+++ b/deps/npm/test/fixtures/config/userconfig-with-gc
@@ -1,4 +1,4 @@
-globalconfig=/Users/ogd/Documents/projects/npm/npm/test/fixtures/config/globalconfig
+globalconfig=/Users/zkat/Documents/code/npm/test/fixtures/config/globalconfig
email=i@izs.me
env-thing=asdf
init.author.name=Isaac Z. Schlueter
diff --git a/deps/npm/test/tap/deprecate.js b/deps/npm/test/tap/deprecate.js
index 1d9a867cd7..987acb80af 100644
--- a/deps/npm/test/tap/deprecate.js
+++ b/deps/npm/test/tap/deprecate.js
@@ -126,6 +126,30 @@ test('npm deprecate bad semver range', function (t) {
})
})
+test('npm deprecate a package with no semver range', function (t) {
+ var deprecated = JSON.parse(JSON.stringify(cache))
+ deprecated.versions = {
+ '0.0.0': { deprecated: 'make it dead' },
+ '0.0.1': { deprecated: 'make it dead' },
+ '0.0.2': { deprecated: 'make it dead' }
+ }
+ server.get('/cond?write=true').reply(200, cache)
+ server.put('/cond', deprecated).reply(201, { deprecated: true })
+ common.npm([
+ 'deprecate',
+ 'cond',
+ 'make it dead',
+ '--registry', common.registry,
+ '--loglevel', 'silent'
+ ], {},
+ function (er, code, stdout, stderr) {
+ t.ifError(er, 'npm deprecate')
+ t.equal(stderr, '', 'no error output')
+ t.equal(code, 0, 'exited OK')
+ t.end()
+ })
+})
+
test('cleanup', function (t) {
server.close()
t.ok(true)
diff --git a/deps/npm/test/tap/link.js b/deps/npm/test/tap/link.js
index 869364c29b..e2f5455200 100644
--- a/deps/npm/test/tap/link.js
+++ b/deps/npm/test/tap/link.js
@@ -3,6 +3,7 @@ var osenv = require('osenv')
var path = require('path')
var rimraf = require('rimraf')
var test = require('tap').test
+var lstatSync = require('fs').lstatSync
var writeFileSync = require('fs').writeFileSync
var common = require('../common-tap.js')
@@ -10,6 +11,7 @@ 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 linkInside = path.join(linkInstall, 'node_modules', 'inside')
var linkRoot = path.join(__dirname, 'link-root')
var config = 'prefix = ' + linkRoot
@@ -57,6 +59,18 @@ var installJSON = {
license: 'ISC'
}
+var insideInstallJSON = {
+ name: 'inside',
+ version: '1.0.0',
+ description: '',
+ main: 'index.js',
+ scripts: {
+ test: 'echo \"Error: no test specified\" && exit 1'
+ },
+ author: '',
+ license: 'ISC'
+}
+
test('setup', function (t) {
setup()
common.npm(['ls', '-g', '--depth=0'], OPTS, function (err, c, out) {
@@ -81,6 +95,20 @@ test('create global link', function (t) {
})
})
+test('create global inside link', function (t) {
+ process.chdir(linkInside)
+ common.npm(['link'], OPTS, function (err, c, out) {
+ t.ifError(err, 'link has no error')
+ common.npm(['ls', '-g'], OPTS, function (err, c, out, stderr) {
+ t.ifError(err)
+ t.equal(c, 0)
+ t.equal(stderr, '', 'got expected stderr')
+ t.has(out, /inside@1.0.0/, 'creates global inside link ok')
+ t.end()
+ })
+ })
+})
+
test('create scoped global link', function (t) {
process.chdir(linkScoped)
common.npm(['link'], OPTS, function (err, c, out) {
@@ -108,6 +136,17 @@ test('link-install the package', function (t) {
})
})
+test('link-inside-install fails', function (t) {
+ process.chdir(linkInstall)
+ t.notOk(lstatSync(linkInside).isSymbolicLink(), 'directory for linked package is not a symlink to begin with')
+ common.npm(['link', 'inside'], OPTS, function (err, code) {
+ t.ifError(err, 'npm removed the linked package without error')
+ t.notEqual(code, 0, 'link operation failed')
+ t.notOk(lstatSync(linkInside).isSymbolicLink(), 'directory for linked package has not turned into a symlink')
+ t.end()
+ })
+})
+
test('link-install the scoped package', function (t) {
process.chdir(linkInstall)
common.npm(['link', linkScoped], OPTS, function (err) {
@@ -141,6 +180,7 @@ function cleanup () {
rimraf.sync(link)
rimraf.sync(linkScoped)
rimraf.sync(linkInstall)
+ rimraf.sync(linkInside)
}
function setup () {
@@ -161,5 +201,10 @@ function setup () {
path.join(linkInstall, 'package.json'),
JSON.stringify(installJSON, null, 2)
)
+ mkdirp.sync(linkInside)
+ writeFileSync(
+ path.join(linkInside, 'package.json'),
+ JSON.stringify(insideInstallJSON, null, 2)
+ )
writeFileSync(configPath, config)
}
diff --git a/deps/npm/test/tap/outdated-symlink.js b/deps/npm/test/tap/outdated-symlink.js
index 203df9ba8f..a5ebea0d2e 100644
--- a/deps/npm/test/tap/outdated-symlink.js
+++ b/deps/npm/test/tap/outdated-symlink.js
@@ -51,19 +51,26 @@ test('setup', function (t) {
test('when outdated is called linked packages should be displayed as such', function (t) {
var regOutLinked = /my-local-package\s*1.0.0\s*linked\s*linked\n/
- var regOutInstallOne = /async\s*0.2.9\s*0.2.9\s*1.5.2\n/
- var regOutInstallTwo = /underscore\s*1.3.1\s*1.3.1\s*1.8.3\n/
+ var regOutInstallOne = /async\s*0.2.9\s*0.2.9\s*0.2.10\n/
+ var regOutInstallTwo = /underscore\s*1.3.1\s*1.3.1\s*1.5.1\n/
console.log = function () {}
mr({ port: common.port }, function (er, s) {
- common.npm(['outdated', '-g'], OPTS, function (err, c, out, stderr) {
- t.ifError(err)
- t.ok(out.match(regOutLinked), 'Global Link format as expected')
- t.ok(out.match(regOutInstallOne), 'Global Install format as expected')
- t.ok(out.match(regOutInstallTwo), 'Global Install format as expected')
- s.close()
- t.end()
- })
+ common.npm(
+ [
+ '--registry', common.registry,
+ 'outdated', '-g'
+ ],
+ OPTS,
+ function (err, c, out, stderr) {
+ t.ifError(err)
+ t.ok(out.match(regOutLinked), 'Global Link format as expected')
+ t.ok(out.match(regOutInstallOne), 'Global Install format as expected')
+ t.ok(out.match(regOutInstallTwo), 'Global Install format as expected')
+ s.close()
+ t.end()
+ }
+ )
})
})
diff --git a/deps/npm/test/tap/search.js b/deps/npm/test/tap/search.js
index 08cc7a6fe6..138517c3bd 100644
--- a/deps/npm/test/tap/search.js
+++ b/deps/npm/test/tap/search.js
@@ -74,6 +74,20 @@ test('No previous cache, init cache triggered by first search', function (t) {
})
})
+test('no arguments provided should error', function (t) {
+ common.npm(['search'], [], function (err, code, stdout, stderr) {
+ if (err) throw err
+ t.equal(code, 1, 'search finished unsuccessfully')
+
+ t.match(
+ stderr,
+ /search must be called with arguments/,
+ 'should have correct error message'
+ )
+ t.end()
+ })
+})
+
test('previous cache, _updated set, should trigger since request', function (t) {
setupCache()