diff options
author | Rebecca Turner <me@re-becca.org> | 2015-06-12 04:04:17 -0400 |
---|---|---|
committer | Jeremiah Senkpiel <fishrock123@rocketmail.com> | 2015-06-15 10:15:55 -0700 |
commit | 3e12561b55de721faf7bcccad1dc0ccef7c28a47 (patch) | |
tree | dfe70fe3d6d00d47981b5df180c5b0d9aff32e1e /deps/npm/test | |
parent | 5c2707c1b2078e0d4ede7fadb1adfa5eebf29210 (diff) | |
download | node-new-3e12561b55de721faf7bcccad1dc0ccef7c28a47.tar.gz |
deps: upgrade to npm 2.11.2
PR-URL: https://github.com/nodejs/io.js/pull/1956
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'deps/npm/test')
-rw-r--r-- | deps/npm/test/fixtures/config/userconfig-with-gc | 2 | ||||
-rw-r--r-- | deps/npm/test/tap/outdated-git.js | 12 | ||||
-rw-r--r-- | deps/npm/test/tap/outdated.js | 43 | ||||
-rw-r--r-- | deps/npm/test/tap/publish-config.js | 2 | ||||
-rw-r--r-- | deps/npm/test/tap/unpublish-config.js | 2 | ||||
-rw-r--r-- | deps/npm/test/tap/version-lifecycle.js | 69 |
6 files changed, 114 insertions, 16 deletions
diff --git a/deps/npm/test/fixtures/config/userconfig-with-gc b/deps/npm/test/fixtures/config/userconfig-with-gc index 62ad80be11..df741e0952 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/zkat/Documents/code/npm/test/fixtures/config/globalconfig +globalconfig=/Users/rebecca/code/release/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/outdated-git.js b/deps/npm/test/tap/outdated-git.js index 0ef243bee3..2162c743c1 100644 --- a/deps/npm/test/tap/outdated-git.js +++ b/deps/npm/test/tap/outdated-git.js @@ -1,8 +1,8 @@ -var fs = require('graceful-fs') var path = require('path') var test = require('tap').test var mkdirp = require('mkdirp') +var fs = require("graceful-fs") var rimraf = require('rimraf') var common = require('../common-tap.js') @@ -18,9 +18,9 @@ var json = { version: '0.0.1', main: 'index.js', dependencies: { + 'foo-github': 'robertkowalski/foo', 'foo-private': 'git://github.com/robertkowalski/foo-private.git', - 'foo-private-credentials': 'git://user:pass@github.com/robertkowalski/foo-private.git', - 'foo-github': 'robertkowalski/foo' + 'foo-private-credentials': 'git://user:pass@github.com/robertkowalski/foo-private.git' } } @@ -36,9 +36,9 @@ test('discovers new versions in outdated', function (t) { npm.commands.outdated([], function (er, d) { t.equal(d[0][3], 'git') t.equal(d[0][4], 'git') - t.equal(d[0][5], 'git://github.com/robertkowalski/foo-private.git') - t.equal(d[1][5], 'git://user:pass@github.com/robertkowalski/foo-private.git') - t.equal(d[2][5], 'github:robertkowalski/foo') + t.equal(d[0][5], 'github:robertkowalski/foo') + t.equal(d[1][5], 'git://github.com/robertkowalski/foo-private.git') + t.equal(d[2][5], 'git://user:pass@github.com/robertkowalski/foo-private.git') }) }) }) diff --git a/deps/npm/test/tap/outdated.js b/deps/npm/test/tap/outdated.js index 8bda330bdd..146c2007a3 100644 --- a/deps/npm/test/tap/outdated.js +++ b/deps/npm/test/tap/outdated.js @@ -12,18 +12,22 @@ var common = require('../common-tap.js') // config var pkg = path.resolve(__dirname, 'outdated') var cache = path.resolve(pkg, 'cache') +var originalLog var json = { name: 'outdated', description: 'fixture', version: '0.0.1', dependencies: { - underscore: '1.3.1' + underscore: '1.3.1', + async: '0.2.9', + checker: '0.5.1' } } test('setup', function (t) { cleanup() + originalLog = console.log mkdirp.sync(cache) fs.writeFileSync( path.join(pkg, 'package.json'), @@ -35,11 +39,18 @@ test('setup', function (t) { }) test('it should not throw', function (t) { - var originalLog = console.log - var output = [] var expOut = [ - path.resolve(pkg, 'node_modules', 'underscore'), + path.resolve(pkg, 'node_modules', 'async') + + ':async@0.2.9' + + ':async@0.2.9' + + ':async@0.2.10' + + '\n' + + path.resolve(pkg, 'node_modules', 'checker') + + ':checker@0.5.1' + + ':checker@0.5.1' + + ':checker@0.5.2' + + '\n' + path.resolve(pkg, 'node_modules', 'underscore') + ':underscore@1.3.1' + ':underscore@1.3.1' + @@ -49,6 +60,22 @@ test('it should not throw', function (t) { var expData = [ [ pkg, + 'async', + '0.2.9', + '0.2.9', + '0.2.10', + '0.2.9' + ], + [ + pkg, + 'checker', + '0.5.1', + '0.5.1', + '0.5.2', + '0.5.1' + ], + [ + pkg, 'underscore', '1.3.1', '1.3.1', @@ -57,9 +84,7 @@ test('it should not throw', function (t) { ] ] - console.log = function () { - output.push.apply(output, arguments) - } + console.log = function () {} mr({ port: common.port }, function (er, s) { npm.load( { @@ -71,6 +96,9 @@ test('it should not throw', function (t) { function () { npm.install('.', function (err) { t.ifError(err, 'install success') + console.log = function () { + output.push.apply(output, arguments) + } npm.outdated(function (er, d) { t.ifError(er, 'outdated success') @@ -90,6 +118,7 @@ test('it should not throw', function (t) { test('cleanup', function (t) { cleanup() + console.log = originalLog t.end() }) diff --git a/deps/npm/test/tap/publish-config.js b/deps/npm/test/tap/publish-config.js index fd6dd4a2a4..1d063535b8 100644 --- a/deps/npm/test/tap/publish-config.js +++ b/deps/npm/test/tap/publish-config.js @@ -29,7 +29,7 @@ test(function (t) { res.end(JSON.stringify({ error: "sshhh. naptime nao. \\^O^/ <(YAWWWWN!)" })) - child.kill() + child.kill('SIGHUP') }).listen(common.port, function () { t.pass("server is listening") diff --git a/deps/npm/test/tap/unpublish-config.js b/deps/npm/test/tap/unpublish-config.js index 58550ec4e5..d6e18eb024 100644 --- a/deps/npm/test/tap/unpublish-config.js +++ b/deps/npm/test/tap/unpublish-config.js @@ -44,7 +44,7 @@ test('cursory test of unpublishing with config', function (t) { res.end(JSON.stringify({ error: 'shh no tears, only dreams now' })) - child.kill() + child.kill('SIGHUP') }).listen(common.port, function () { t.pass('server is listening') diff --git a/deps/npm/test/tap/version-lifecycle.js b/deps/npm/test/tap/version-lifecycle.js new file mode 100644 index 0000000000..4bd39338ca --- /dev/null +++ b/deps/npm/test/tap/version-lifecycle.js @@ -0,0 +1,69 @@ +var fs = require('graceful-fs') +var path = require('path') + +var mkdirp = require('mkdirp') +var osenv = require('osenv') +var rimraf = require('rimraf') +var test = require('tap').test + +var common = require('../common-tap.js') +var npm = require('../../') +var pkg = path.resolve(__dirname, 'version-lifecycle') +var cache = path.resolve(pkg, 'cache') + +test('npm version <semver> with failing preversion lifecycle script', function (t) { + setup() + fs.writeFileSync(path.resolve(pkg, 'package.json'), JSON.stringify({ + author: 'Alex Wolfe', + name: 'version-lifecycle', + version: '0.0.0', + description: 'Test for npm version if preversion script fails', + scripts: { + preversion: './fail.sh' + } + }), 'utf8') + fs.writeFileSync(path.resolve(pkg, 'fail.sh'), 'exit 50', {mode: 448}) + npm.load({cache: cache, registry: common.registry}, function () { + var version = require('../../lib/version') + version(['patch'], function (err) { + t.ok(err) + t.ok(err.message.match(/Exit status 50/)) + t.end() + }) + }) +}) + +test('npm version <semver> with failing postversion lifecycle script', function (t) { + setup() + fs.writeFileSync(path.resolve(pkg, 'package.json'), JSON.stringify({ + author: 'Alex Wolfe', + name: 'version-lifecycle', + version: '0.0.0', + description: 'Test for npm version if postversion script fails', + scripts: { + postversion: './fail.sh' + } + }), 'utf8') + fs.writeFileSync(path.resolve(pkg, 'fail.sh'), 'exit 50', {mode: 448}) + npm.load({cache: cache, registry: common.registry}, function () { + var version = require('../../lib/version') + version(['patch'], function (err) { + t.ok(err) + t.ok(err.message.match(/Exit status 50/)) + t.end() + }) + }) +}) + +test('cleanup', function (t) { + process.chdir(osenv.tmpdir()) + rimraf.sync(pkg) + t.end() +}) + +function setup () { + mkdirp.sync(pkg) + mkdirp.sync(path.join(pkg, 'node_modules')) + mkdirp.sync(cache) + process.chdir(pkg) +} |