Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -1,5 +1,5 @@
{
"version": "1.3.14",
"version": "1.3.15",
"name": "npm",
"publishConfig": {
"proprietary-attribs": false
@@ -50,7 +50,7 @@
"mkdirp": "~0.3.5",
"read": "~1.0.4",
"lru-cache": "~2.3.1",
"node-gyp": "~0.11.0",
"node-gyp": "~0.12.0",
"fstream-npm": "~0.1.6",
"uid-number": "0",
"archy": "0",
@@ -61,12 +61,12 @@
"read-package-json": "~1.1.4",
"read-installed": "~0.2.2",
"glob": "~3.2.6",
"init-package-json": "0.0.11",
"init-package-json": "0.0.13",
"osenv": "0",
"lockfile": "~0.4.0",
"retry": "~0.6.0",
"once": "~1.3.0",
"npmconf": "~0.1.5",
"npmconf": "~0.1.6",
"opener": "~1.3.0",
"chmodr": "~0.1.0",
"cmd-shim": "~1.1.1",
@@ -152,15 +152,11 @@ if [ -z "$t" ]; then
# switch based on node version.
# note that we can only use strict sh-compatible patterns here.
case $node_version in
0.[0123].* | v0.[0123].*)
0.[012345].* | v0.[012345].*)
echo "You are using an outdated and unsupported version of" >&2
echo "node ($node_version). Please update node and try again." >&2
exit 99
;;
v0.[45].* | 0.[45].*)
echo "install npm@1.0"
t=1.0
;;
v0.[678].* | 0.[678].*)
echo "install npm@1.1"
t=1.1
@@ -0,0 +1,2 @@
var port = exports.port = 1337
exports.registry = "http://localhost:" + port
@@ -1,3 +1,4 @@
var common = require("../common-tap.js")
var test = require("tap").test
var npm = require("../../")
var pkg = './ignore-shrinkwrap'
@@ -16,8 +17,8 @@ var customMocks = {
}
}

test("ignore-shrinkwrap: using the option", function(t) {
mr({port: 1337, mocks: customMocks}, function (s) {
test("ignore-shrinkwrap: using the option", function (t) {
mr({port: common.port, mocks: customMocks}, function (s) {
s._server.on("request", function (req, res) {
switch (req.url) {
case "/shrinkwrap.js":
@@ -35,8 +36,8 @@ test("ignore-shrinkwrap: using the option", function(t) {
})
})

test("ignore-shrinkwrap: NOT using the option", function(t) {
mr({port: 1337, mocks: customMocks}, function (s) {
test("ignore-shrinkwrap: NOT using the option", function (t) {
mr({port: common.port, mocks: customMocks}, function (s) {
s._server.on("request", function (req, res) {
switch (req.url) {
case "/shrinkwrap.js":
@@ -65,7 +66,7 @@ function createChild (ignoreShrinkwrap) {
return spawn(node, args, {
cwd: pkg,
env: {
npm_config_registry: "http://localhost:1337",
npm_config_registry: common.registry,
npm_config_cache_lock_stale: 1000,
npm_config_cache_lock_wait: 1000,
HOME: process.env.HOME,
@@ -0,0 +1,17 @@
var test = require("tap").test
var npm = require.resolve("../../bin/npm-cli.js")
var node = process.execPath
var spawn = require("child_process").spawn
var path = require("path")
var pkg = path.resolve(__dirname, "lifecycle-signal")

test("lifecycle signal abort", function (t) {
var child = spawn(node, [npm, "install"], {
cwd: pkg
})
child.on("close", function (code, signal) {
t.equal(code, null)
t.equal(signal, "SIGSEGV")
t.end()
})
})
@@ -0,0 +1,3 @@
{ "name":"lifecycle-signal",
"version":"1.2.5",
"scripts": {"preinstall":"node -e 'process.kill(process.pid,\"SIGSEGV\")'"}}
@@ -1,3 +1,4 @@
var common = require("../common-tap.js")
var test = require("tap").test
var npm = require.resolve("../../bin/npm-cli.js")
var osenv = require("osenv")
@@ -18,6 +19,7 @@ pkg += path.sep + "noargs-install-config-save"
function writePackageJson() {
rimraf.sync(pkg)
mkdirp.sync(pkg)
mkdirp.sync(pkg + "/cache")

fs.writeFileSync(pkg + "/package.json", JSON.stringify({
"author": "Rocko Artischocko",
@@ -32,7 +34,8 @@ function writePackageJson() {
function createChild (args) {
var env = {
npm_config_save: true,
npm_config_registry: "http://localhost:1337",
npm_config_registry: common.registry,
npm_config_cache: pkg + "/cache",
HOME: process.env.HOME,
Path: process.env.PATH,
PATH: process.env.PATH
@@ -43,7 +46,6 @@ function createChild (args) {

return spawn(node, args, {
cwd: pkg,
stdio: "inherit",
env: env
})
}
@@ -52,7 +54,7 @@ test("does not update the package.json with empty arguments", function (t) {
writePackageJson()
t.plan(1)

mr(1337, function (s) {
mr(common.port, function (s) {
var child = createChild([npm, "install"])
child.on("close", function (m) {
var text = JSON.stringify(fs.readFileSync(pkg + "/package.json", "utf8"))
@@ -67,7 +69,7 @@ test("updates the package.json (adds dependencies) with an argument", function (
writePackageJson()
t.plan(1)

mr(1337, function (s) {
mr(common.port, function (s) {
var child = createChild([npm, "install", "underscore"])
child.on("close", function (m) {
var text = JSON.stringify(fs.readFileSync(pkg + "/package.json", "utf8"))
@@ -76,4 +78,9 @@ test("updates the package.json (adds dependencies) with an argument", function (
t.end()
})
})
})
})

test("cleanup", function (t) {
rimraf.sync(pkg + "/cache")
t.end()
})
@@ -1,23 +1,28 @@
var common = require("../common-tap.js")
var test = require("tap").test
var npm = require("../../")

var mkdirp = require("mkdirp")
var rimraf = require("rimraf")
var mr = require("npm-registry-mock")

// config
var port = 1331
var address = "http://localhost:" + port
var pkg = __dirname + '/outdated-include-devdependencies'

mkdirp.sync(pkg + "/cache")

test("includes devDependencies in outdated", function (t) {
process.chdir(pkg)
mr(port, function (s) {
npm.load({registry: address}, function () {
mr(common.port, function (s) {
npm.load({cache: pkg + "/cache", registry: common.registry}, function () {
npm.outdated(function (er, d) {
t.equal("1.5.1", d[0][3])
s.close()
t.end()
})
})
})
})
})

test("cleanup", function (t) {
rimraf.sync(pkg + "/cache")
t.end()
})
@@ -1,23 +1,21 @@
var common = require("../common-tap.js")
var test = require("tap").test
var npm = require("../../")
var mkdirp = require("mkdirp")
var rimraf = require("rimraf")


var mr = require("npm-registry-mock")

// config
var port = 1331
var address = "http://localhost:" + port
var pkg = __dirname + "/outdated-new-versions"
mkdirp.sync(pkg + "/cache")


test("dicovers new versions in outdated", function (t) {
process.chdir(pkg)
t.plan(2)
mr(port, function (s) {
npm.load({cache: pkg + "/cache", registry: address}, function () {

mr(common.port, function (s) {
npm.load({cache: pkg + "/cache", registry: common.registry}, function () {
npm.outdated(function (er, d) {
for (var i = 0; i < d.length; i++) {
if (d[i][1] === "underscore")
@@ -1,20 +1,23 @@
var common = require("../common-tap.js")
var fs = require("fs")
var test = require("tap").test
var rimraf = require("rimraf")
var npm = require("../../")

var mr = require("npm-registry-mock")
// config
var port = 1331
var address = "http://localhost:" + port
var pkg = __dirname + '/outdated'

test("it should not throw", function (t) {
rimraf.sync(pkg + "/node_modules")
cleanup()
process.chdir(pkg)

mr(port, function (s) {
npm.load({registry: address}, function () {
mr(common.port, function (s) {
npm.load({
cache: pkg + "/cache",
loglevel: 'silent',
registry: common.registry }
, function () {
npm.install(".", function (err) {
npm.outdated(function (er, d) {
console.log(d)
@@ -27,6 +30,11 @@ test("it should not throw", function (t) {
})

test("cleanup", function (t) {
rimraf.sync(pkg + "/node_modules")
cleanup()
t.end()
})
})

function cleanup () {
rimraf.sync(pkg + "/node_modules")
rimraf.sync(pkg + "/cache")
}
@@ -0,0 +1 @@
# just a test
@@ -1,8 +1,10 @@
{
"name": "bla",
"description": "fixture",
"version": "0.0.1",
"main": "index.js",
"dependencies": {
"underscore": "1.3.1"
}
},
"repository": "git://github.com/robertkowalski/bogusfixture"
}
@@ -1,3 +1,4 @@
var common = require('../common-tap.js')
var fs = require("fs")
var test = require("tap").test
var rimraf = require("rimraf")
@@ -42,7 +43,7 @@ test("setup", function(t) {
return res.end(failFile)
}
})
server.listen(1337, function() {
server.listen(common.port, function() {
t.pass("listening")
t.end()
})
@@ -1,3 +1,4 @@
var common = require('../common-tap.js')
var fs = require("fs")
var test = require("tap").test
var rimraf = require("rimraf")
@@ -25,7 +26,7 @@ test("setup", function(t) {
s.setHeader('content-type', 'application/javascript')
s.end(js)
})
server.listen(1337, function() {
server.listen(common.port, function () {
t.pass('listening')
t.end()
})
@@ -38,7 +39,7 @@ test("installing a peerDependencies-using package without a package.json present
process.chdir(__dirname + "/peer-deps-without-package-json")

npm.load(function () {
npm.install('http://localhost:1337/', function (err) {
npm.install(common.registry, function (err) {
if (err) {
t.fail(err)
} else {
@@ -1,3 +1,4 @@
var common = require('../common-tap.js')
var test = require('tap').test
var fs = require('fs')
var osenv = require('osenv')
@@ -9,7 +10,7 @@ require('mkdirp').sync(pkg)
fs.writeFileSync(pkg + '/package.json', JSON.stringify({
name: 'npm-test-publish-config',
version: '1.2.3',
publishConfig: { registry: 'http://localhost:13370' }
publishConfig: { registry: common.registry }
}), 'utf8')

var spawn = require('child_process').spawn
@@ -25,7 +26,7 @@ test(function (t) {
res.statusCode = 500
res.end('{"error":"sshhh. naptime nao. \\^O^/ <(YAWWWWN!)"}')
child.kill()
}).listen(13370, function () {
}).listen(common.port, function () {
t.pass('server is listening')

// don't much care about listening to the child's results
@@ -1,24 +1,41 @@
var test = require("tap").test
, npm = require("../../")
, rimraf = require("rimraf")
, mr = require("npm-registry-mock")
, common = require("../common-tap.js")
, pkg = __dirname + "/uninstall-package"

test("returns a list of removed items", function (t) {
t.plan(1)

setup(function () {
npm.install(".", function (err) {
if (err) return t.fail(err)
npm.uninstall("once", "ini", "lala", function (err, d) {
mr(common.port, function (s) {
setup(function () {
npm.install(".", function (err) {
if (err) return t.fail(err)
t.same(d.sort(), ["once", "ini"].sort())
t.end()
npm.uninstall("underscore", "request", "lala", function (err, d) {
if (err) return t.fail(err)
t.same(d.sort(), ["underscore", "request"].sort())
s.close()
t.end()
})
})
})
})
})

test("cleanup", function (t) {
cleanup()
t.end()
})

function setup (cb) {
process.chdir(__dirname + "/uninstall-package")
npm.load(function () {
cleanup()
process.chdir(pkg)
npm.load({cache: pkg + "/cache", registry: common.registry}, function () {
cb()
})
}

function cleanup () {
rimraf.sync(pkg + "/node_modules")
rimraf.sync(pkg + "/cache")
}
@@ -1,9 +1,11 @@
{
"name": "beep",
"version": "0.0.0",
"author": "Rockbert",
"description": "i am a fixture",
"main": "index.js",
"dependencies": {
"once": "*",
"ini": "*"
"underscore": "~1.3.1",
"request": "~0.9.0"
}
}