diff options
author | isaacs <i@izs.me> | 2012-07-13 11:40:38 -0700 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-07-13 12:08:17 -0700 |
commit | 9d4362403c10dd28b5644b947945f853cd354f28 (patch) | |
tree | c08bf8dd199ee4231a28bd2bb7d5e93c80b43123 /deps/npm/node_modules/npm-registry-client | |
parent | acbfc408880a12c32ccc9d69bca91aad4e93e879 (diff) | |
download | node-new-9d4362403c10dd28b5644b947945f853cd354f28.tar.gz |
npm: upgrade to 1.1.41
Diffstat (limited to 'deps/npm/node_modules/npm-registry-client')
13 files changed, 356 insertions, 24 deletions
diff --git a/deps/npm/node_modules/npm-registry-client/index.js b/deps/npm/node_modules/npm-registry-client/index.js index 673789f9b0..c7bc21efcb 100644 --- a/deps/npm/node_modules/npm-registry-client/index.js +++ b/deps/npm/node_modules/npm-registry-client/index.js @@ -6,24 +6,34 @@ module.exports = RegClient var fs = require('fs') , url = require('url') , path = require('path') +, CouchLogin = require('couch-login') , npmlog try { npmlog = require("npmlog") } catch (er) { npmlog = { error: noop, warn: noop, info: noop, - verbose: noop, silly: noop, http: silly, + verbose: noop, silly: noop, http: noop, pause: noop, resume: noop } } function noop () {} function RegClient (options) { - // a registry url must be provided. - var registry = url.parse(options.registry) - if (!registry.protocol) throw new Error( - 'Invalid registry: ' + registry.url) - this.registry = registry.href + // if provided, then the registry needs to be a url. + // if it's not provided, then we're just using the cache only. + var registry = options.registry + if (registry) { + registry = url.parse(registry) + if (!registry.protocol) throw new Error( + 'Invalid registry: ' + registry.url) + this.registry = registry.href + if (this.registry.slice(-1) !== '/') { + this.registry += '/' + } + } else { + this.registry = null + } this.retries = options.retries || 2 this.retryFactor = options.retryFactor || 10 @@ -41,7 +51,25 @@ function RegClient (options) { a = a.split(":") this.username = a.shift() this.password = a.join(":") + } else { + this.username = options.username + this.password = options.password + + // if username and password are set, but auth isn't, use them. + if (this.username && this.password) { + var a = this.username + ":" + this.password + this.auth = new Buffer(a, "utf8").toString("base64") + } + } + + if (this.auth && !this.alwaysAuth && this.registry) { + // if we're always authing, then we just send the + // user/pass on every thing. otherwise, create a + // session, and use that. + this.token = options.token + this.couchLogin = new CouchLogin(this.registry, this.token) } + this.email = options.email || null this.defaultTag = options.tag || "latest" diff --git a/deps/npm/node_modules/npm-registry-client/lib/get.js b/deps/npm/node_modules/npm-registry-client/lib/get.js index b56fefcc63..835eb4ce51 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/get.js +++ b/deps/npm/node_modules/npm-registry-client/lib/get.js @@ -15,6 +15,8 @@ function get (uri, timeout, nofollow, staleOk, cb) { timeout = Math.min(timeout, this.cacheMax) timeout = Math.max(timeout, this.cacheMin) + if (!this.registry) timeout = Infinity + if ( process.env.COMP_CWORD !== undefined && process.env.COMP_LINE !== undefined && process.env.COMP_POINT !== undefined diff --git a/deps/npm/node_modules/npm-registry-client/lib/request.js b/deps/npm/node_modules/npm-registry-client/lib/request.js index 1c6eb35e11..384b0d89d5 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/request.js +++ b/deps/npm/node_modules/npm-registry-client/lib/request.js @@ -13,6 +13,9 @@ function regRequest (method, where, what, etag, nofollow, cb_) { if (typeof cb_ !== "function") cb_ = etag, etag = null if (typeof cb_ !== "function") cb_ = what, what = null + if (!this.registry) return cb(new Error( + "No registry url provided: " + method + " " + where)) + // Since there are multiple places where an error could occur, // don't let the cb be called more than once. var errState = null @@ -29,11 +32,12 @@ function regRequest (method, where, what, etag, nofollow, cb_) { var registry = this.registry var adduserChange = /^\/?-\/user\/org\.couchdb\.user:([^\/]+)\/-rev/ - , adduserNew = /^\/?-\/user\/org\.couchdb\.user:([^\/]+)/ - , authRequired = (what || this.alwaysAuth) - && !where.match(adduserNew) - || where.match(adduserChange) - || method === "DELETE" + , adduserNew = /^\/?-\/user\/org\.couchdb\.user:([^\/]+)/ + , nu = where.match(adduserNew) + , uc = where.match(adduserChange) + , isUpload = what || this.alwaysAuth + , isDel = method === "DELETE" + , authRequired = isUpload && !nu || uc || isDel // resolve to a full url on the registry if (!where.match(/^https?:\/\//)) { @@ -58,20 +62,39 @@ function regRequest (method, where, what, etag, nofollow, cb_) { } var remote = url.parse(where) - , auth = authRequired && this.auth - - if (authRequired && !auth && this.username && this.password) { - var a = this.username + ":" + this.password - a = new Buffer(a, "utf8").toString("base64") - auth = this.auth = a + , auth = this.auth + + if (authRequired && !this.alwaysAuth) { + var couch = this.couchLogin + , token = couch && (this.token || couch.token) + , validToken = token && couch.valid(token) + + if (!validToken) token = null + else this.token = token + + if (couch && !token) { + // login to get a valid token + var a = { name: this.username, password: this.password } + var args = arguments + return this.couchLogin.login(a, function (er, cr, data) { + if (er || !couch.valid(couch.token)) { + er = er || new Error('login error') + return cb(er, cr, data) + } + this.token = this.couchLogin.token + return regRequest.call(this, method, where, what, etag, nofollow, cb_) + }.bind(this)) + } } - if (authRequired && !auth) { + // now we either have a valid token, or an auth. + + if (authRequired && !auth && !token) { return cb(new Error( "Cannot insert data into the registry without auth")) } - if (auth) { + if (auth && !token) { remote.auth = new Buffer(auth, "base64").toString("utf8") } @@ -87,7 +110,7 @@ function regRequest (method, where, what, etag, nofollow, cb_) { operation.attempt(function (currentAttempt) { self.log.info("retry", "registry request attempt " + currentAttempt + " at " + (new Date()).toLocaleTimeString()) - makeRequest.call(self, method, remote, where, what, etag, nofollow + makeRequest.call(self, method, remote, where, what, etag, nofollow, token , function (er, parsed, raw, response) { // Only retry on 408, 5xx or no `response`. var statusCode = response && response.statusCode @@ -101,7 +124,7 @@ function regRequest (method, where, what, etag, nofollow, cb_) { }) } -function makeRequest (method, remote, where, what, etag, nofollow, cb_) { +function makeRequest (method, remote, where, what, etag, nofollow, tok, cb_) { var cbCalled = false function cb () { if (cbCalled) return @@ -112,7 +135,6 @@ function makeRequest (method, remote, where, what, etag, nofollow, cb_) { var opts = { url: remote , method: method , ca: this.ca - , follow: false , strictSSL: this.strictSSL } , headers = opts.headers = {} if (etag) { @@ -120,6 +142,10 @@ function makeRequest (method, remote, where, what, etag, nofollow, cb_) { headers[method === "GET" ? "if-none-match" : "if-match"] = etag } + if (tok) { + headers.cookie = 'AuthSession=' + tok.AuthSession + } + headers.accept = "application/json" headers["user-agent"] = this.userAgent diff --git a/deps/npm/node_modules/npm-registry-client/package.json b/deps/npm/node_modules/npm-registry-client/package.json index 08ecd7ef96..47b6dc4b7f 100644 --- a/deps/npm/node_modules/npm-registry-client/package.json +++ b/deps/npm/node_modules/npm-registry-client/package.json @@ -6,7 +6,7 @@ }, "name": "npm-registry-client", "description": "Client for the npm registry", - "version": "0.0.8", + "version": "0.0.10", "repository": { "url": "git://github.com/isaacs/npm-registry-client" }, @@ -24,6 +24,7 @@ "mkdirp": "~0.3.3", "rimraf": "~2.0.1", "retry": "0.6.0", + "couch-login": "~0.1.6", "npmlog": "" }, "devDependencies": { @@ -34,6 +35,6 @@ }, "license": "BSD", "readme": "# npm-registry-client\n\nThe code that npm uses to talk to the registry.\n\nIt handles all the caching and HTTP calls.\n\n## Usage\n\n```javascript\nvar RegClient = require('npm-registry-client')\nvar client = new RegClient(options)\n\nclient.get(\"npm\", \"latest\", 1000, function (er, data, raw, res) {\n // error is an error if there was a problem.\n // data is the parsed data object\n // raw is the json string\n // res is the response from couch\n})\n```\n\n# Options\n\n* `registry` **Required** {String} URL to the registry\n* `cache` **Required** {String} Path to the cache folder\n* `alwaysAuth` {Boolean} Auth even for GET requests.\n* `auth` {String} A base64-encoded `username:password`\n* `email` {String} User's email address\n* `tag` {String} The default tag to use when publishing new packages.\n Default = `\"latest\"`\n* `ca` {String} Cerficate signing authority certificates to trust.\n* `strictSSL` {Boolean} Whether or not to be strict with SSL\n certificates. Default = `true`\n* `userAgent` {String} User agent header to send. Default =\n `\"node/{process.version}\"`\n* `log` {Object} The logger to use. Defaults to `require(\"npmlog\")` if\n that works, otherwise logs are disabled.\n* `retries` {Number} Number of times to retry on GET failures.\n Default=2\n* `retryFactor` {Number} `factor` setting for `node-retry`. Default=10\n* `retryMinTimeout` {Number} `minTimeout` setting for `node-retry`.\n Default=10000 (10 seconds)\n* `retryMaxTimeout` {Number} `maxTimeout` setting for `node-retry`.\n Default=60000 (60 seconds)\n\n# client.request(method, where, [what], [etag], [nofollow], cb)\n\n* `method` {String} HTTP method\n* `where` {String} Path to request on the server\n* `what` {Stream | Buffer | String | Object} The request body. Objects\n that are not Buffers or Streams are encoded as JSON.\n* `etag` {String} The cached ETag\n* `nofollow` {Boolean} Prevent following 302/301 responses\n* `cb` {Function}\n * `error` {Error | null}\n * `data` {Object} the parsed data object\n * `raw` {String} the json\n * `res` {Response Object} response from couch\n\nMake a request to the registry. All the other methods are wrappers\naround this. one.\n\n# client.adduser(username, password, email, cb)\n\n* `username` {String}\n* `password` {String}\n* `email` {String}\n* `cb` {Function}\n\nAdd a user account to the registry, or verify the credentials.\n\n# client.get(url, [timeout], [nofollow], [staleOk], cb)\n\n* `url` {String} The url path to fetch\n* `timeout` {Number} Number of seconds old that a cached copy must be\n before a new request will be made.\n* `nofollow` {Boolean} Do not follow 301/302 responses\n* `staleOk` {Boolean} If there's cached data available, then return that\n to the callback quickly, and update the cache the background.\n\nFetches data from the registry via a GET request, saving it in\nthe cache folder with the ETag.\n\n# client.publish(data, tarball, [readme], cb)\n\n* `data` {Object} Package data\n* `tarball` {String | Stream} Filename or stream of the package tarball\n* `readme` {String} Contents of the README markdown file\n* `cb` {Function}\n\nPublish a package to the registry.\n\nNote that this does not create the tarball from a folder. However, it\ncan accept a gzipped tar stream or a filename to a tarball.\n\n# client.star(package, starred, cb)\n\n* `package` {String} Name of the package to star\n* `starred` {Boolean} True to star the package, false to unstar it.\n* `cb` {Function}\n\nStar or unstar a package.\n\nNote that the user does not have to be the package owner to star or\nunstar a package, though other writes do require that the user be the\npackage owner.\n\n# client.tag(project, version, tag, cb)\n\n* `project` {String} Project name\n* `version` {String} Version to tag\n* `tag` {String} Tag name to apply\n* `cb` {Function}\n\nMark a version in the `dist-tags` hash, so that `pkg@tag`\nwill fetch the specified version.\n\n# client.unpublish(name, [ver], cb)\n\n* `name` {String} package name\n* `ver` {String} version to unpublish. Leave blank to unpublish all\n versions.\n* `cb` {Function}\n\nRemove a version of a package (or all versions) from the registry. When\nthe last version us unpublished, the entire document is removed from the\ndatabase.\n\n# client.upload(where, file, [etag], [nofollow], cb)\n\n* `where` {String} URL path to upload to\n* `file` {String | Stream} Either the filename or a readable stream\n* `etag` {String} Cache ETag\n* `nofollow` {Boolean} Do not follow 301/302 responses\n* `cb` {Function}\n\nUpload an attachment. Mostly used by `client.publish()`.\n", - "_id": "npm-registry-client@0.0.8", + "_id": "npm-registry-client@0.0.10", "_from": "npm-registry-client@0" } diff --git a/deps/npm/node_modules/npm-registry-client/test/00-setup.js b/deps/npm/node_modules/npm-registry-client/test/00-setup.js new file mode 100644 index 0000000000..747768fb85 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/test/00-setup.js @@ -0,0 +1,10 @@ +var tap = require('tap') +var rimraf = require('rimraf') + +tap.test('setup', function (t) { + rimraf(__dirname + '/fixtures/cache', function (er) { + if (er) throw er + t.pass('cache cleaned') + t.end() + }) +}) diff --git a/deps/npm/node_modules/npm-registry-client/test/adduser-new.js b/deps/npm/node_modules/npm-registry-client/test/adduser-new.js new file mode 100644 index 0000000000..a0fee04c30 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/test/adduser-new.js @@ -0,0 +1,51 @@ +var tap = require('tap') +var server = require('./fixtures/server.js') +var RC = require('../') +var client = new RC({ + cache: __dirname + '/fixtures/cache' + , registry: 'http://localhost:' + server.port }) + +var userdata = +{ name: 'username', + email: 'i@izs.me', + _id: 'org.couchdb.user:username', + type: 'user', + roles: [], + date: '2012-06-07T04:11:21.591Z' } +, password = "password" +, username = "username" +, crypto = require("crypto") +, SD = require('string_decoder').StringDecoder +, decoder = new SD + +function sha (s) { + return crypto.createHash("sha1").update(s).digest("hex") +} + +tap.test("create new user account", function (t) { + server.expect("/-/user/org.couchdb.user:username", function (req, res) { + t.equal(req.method, "PUT") + var b = "" + req.on("data", function (d) { + b += decoder.write(d) + }) + + req.on("end", function () { + var o = JSON.parse(b) + var salt = o.salt + userdata.salt = salt + userdata.password_sha = sha(password + salt) + userdata.date = o.date + t.deepEqual(o, userdata) + + res.statusCode = 201 + res.json({created:true}) + }) + }) + + client.adduser(username, password, "i@izs.me", function (er, data, raw, res) { + if (er) throw er + t.deepEqual(data, { created: true }) + t.end() + }) +}) diff --git a/deps/npm/node_modules/npm-registry-client/test/adduser-update.js b/deps/npm/node_modules/npm-registry-client/test/adduser-update.js new file mode 100644 index 0000000000..03a1edbb26 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/test/adduser-update.js @@ -0,0 +1,68 @@ +var tap = require('tap') +var server = require('./fixtures/server.js') +var RC = require('../') +var client = new RC({ + cache: __dirname + '/fixtures/cache' + , registry: 'http://localhost:' + server.port }) + +var userdata = +{ name: 'username', + email: 'i@izs.me', + _id: 'org.couchdb.user:username', + type: 'user', + roles: [], + _rev: "1-15aac515ac515aac515aac515aac5125" +} + +, password = "password" +, username = "username" +, crypto = require("crypto") +, SD = require('string_decoder').StringDecoder +, decoder = new SD + + +function sha (s) { + return crypto.createHash("sha1").update(s).digest("hex") +} + +tap.test("update a user acct", function (t) { + server.expect("PUT", "/-/user/org.couchdb.user:username", function (req, res) { + t.equal(req.method, "PUT") + res.statusCode = 409 + res.json({error: "conflict"}) + }) + + server.expect("GET", "/-/user/org.couchdb.user:username", function (req, res) { + t.equal(req.method, "GET") + res.json(userdata) + }) + + server.expect("PUT", "/-/user/org.couchdb.user:username/-rev/" + userdata._rev, function (req, res) { + t.equal(req.method, "PUT") + + var b = "" + req.on("data", function (d) { + b += decoder.write(d) + }) + + req.on("end", function () { + var o = JSON.parse(b) + var salt = o.salt + userdata.salt = salt + userdata.password_sha = sha(password + salt) + userdata.date = o.date + t.deepEqual(o, userdata) + + res.statusCode = 201 + res.json({created:true}) + }) + }) + + + + client.adduser(username, password, "i@izs.me", function (er, data, raw, res) { + if (er) throw er + t.deepEqual(data, { created: true }) + t.end() + }) +}) diff --git a/deps/npm/node_modules/npm-registry-client/test/basic.js b/deps/npm/node_modules/npm-registry-client/test/basic.js new file mode 100644 index 0000000000..022466aeea --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/test/basic.js @@ -0,0 +1,32 @@ +var tap = require('tap') +var server = require('./fixtures/server.js') +var RC = require('../') +var rimraf = require("rimraf") +var client = new RC({ + cache: __dirname + '/fixtures/cache' + , registry: 'http://localhost:' + server.port }) +var us = require('./fixtures/underscore/1.3.3/cache.json') +var usroot = require("./fixtures/underscore/cache.json") + +tap.test("basic request", function (t) { + server.expect("/underscore/1.3.3", function (req, res) { + console.error('got a request') + res.json(us) + }) + + server.expect("/underscore", function (req, res) { + console.error('got a request') + res.json(usroot) + }) + + t.plan(2) + client.get("/underscore/1.3.3", function (er, data, raw, res) { + console.error("got response") + t.deepEqual(data, us) + }) + + client.get("/underscore", function (er, data, raw, res) { + console.error("got response") + t.deepEqual(data, usroot) + }) +}) diff --git a/deps/npm/node_modules/npm-registry-client/test/fixtures/server.js b/deps/npm/node_modules/npm-registry-client/test/fixtures/server.js new file mode 100644 index 0000000000..468a89e5bf --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/test/fixtures/server.js @@ -0,0 +1,56 @@ +// a fake registry server. + +var http = require('http') +var server = http.createServer(handler) +var port = server.port = process.env.PORT || 1337 +server.listen(port) + +module.exports = server + +server._expect = {} + +var expect = {} +function handler (req, res) { + req.connection.setTimeout(1000) + + var u = '* ' + req.url + , mu = req.method + ' ' + req.url + + var k = server._expect[mu] ? mu : server._expect[u] ? u : null + if (!k) throw Error('unexpected request', req.method, req.url) + + var fn = server._expect[k].shift() + if (!fn) throw Error('unexpected request', req.method, req.url) + + + var remain = (Object.keys(server._expect).reduce(function (s, k) { + return s + server._expect[k].length + }, 0)) + if (remain === 0) server.close() + else console.error("TEST SERVER: %d reqs remain", remain) + console.error(Object.keys(server._expect).map(function(k) { + return [k, server._expect[k].length] + }).reduce(function (acc, kv) { + acc[kv[0]] = kv[1] + return acc + }, {})) + + res.json = json + fn(req, res) +} + +function json (o) { + this.setHeader('content-type', 'application/json') + this.end(JSON.stringify(o)) +} + +server.expect = function (method, u, fn) { + if (typeof u === 'function') { + fn = u + u = method + method = '*' + } + u = method + ' ' + u + server._expect[u] = server._expect[u] || [] + server._expect[u].push(fn) +} diff --git a/deps/npm/node_modules/npm-registry-client/test/fixtures/underscore/1.3.3/cache.json b/deps/npm/node_modules/npm-registry-client/test/fixtures/underscore/1.3.3/cache.json new file mode 100644 index 0000000000..01da300276 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/test/fixtures/underscore/1.3.3/cache.json @@ -0,0 +1 @@ +{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.3.3","_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"_id":"underscore@1.3.3","dependencies":{},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.1","_nodeVersion":"v0.6.11","_defaultsLoaded":true,"dist":{"shasum":"47ac53683daf832bfa952e1774417da47817ae42","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.3.3.tgz"},"readme":" __ \n /\\ \\ __ \n __ __ ___ \\_\\ \\ __ _ __ ____ ___ ___ _ __ __ /\\_\\ ____ \n /\\ \\/\\ \\ /' _ `\\ /'_ \\ /'__`\\/\\ __\\/ ,__\\ / ___\\ / __`\\/\\ __\\/'__`\\ \\/\\ \\ /',__\\ \n \\ \\ \\_\\ \\/\\ \\/\\ \\/\\ \\ \\ \\/\\ __/\\ \\ \\//\\__, `\\/\\ \\__//\\ \\ \\ \\ \\ \\//\\ __/ __ \\ \\ \\/\\__, `\\\n \\ \\____/\\ \\_\\ \\_\\ \\___,_\\ \\____\\\\ \\_\\\\/\\____/\\ \\____\\ \\____/\\ \\_\\\\ \\____\\/\\_\\ _\\ \\ \\/\\____/\n \\/___/ \\/_/\\/_/\\/__,_ /\\/____/ \\/_/ \\/___/ \\/____/\\/___/ \\/_/ \\/____/\\/_//\\ \\_\\ \\/___/ \n \\ \\____/ \n \\/___/\n \nUnderscore.js is a utility-belt library for JavaScript that provides \nsupport for the usual functional suspects (each, map, reduce, filter...) \nwithout extending any core JavaScript objects.\n\nFor Docs, License, Tests, and pre-packed downloads, see:\nhttp://documentcloud.github.com/underscore/\n\nMany thanks to our contributors:\nhttps://github.com/documentcloud/underscore/contributors\n","maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}}
\ No newline at end of file diff --git a/deps/npm/node_modules/npm-registry-client/test/fixtures/underscore/cache.json b/deps/npm/node_modules/npm-registry-client/test/fixtures/underscore/cache.json new file mode 100644 index 0000000000..d899f11922 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/test/fixtures/underscore/cache.json @@ -0,0 +1 @@ +{"_id":"underscore","_rev":"72-47f2986bfd8e8b55068b204588bbf484","name":"underscore","description":"JavaScript's functional programming helper library.","dist-tags":{"latest":"1.3.3","stable":"1.3.3"},"versions":{"1.0.3":{"name":"underscore","description":"Functional programming aid for JavaScript. Works well with jQuery.","url":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"lib":".","main":"underscore","version":"1.0.3","_id":"underscore@1.0.3","engines":{"node":"*"},"_nodeSupported":true,"_npmVersion":"0.2.7-2","_nodeVersion":"v0.3.1-pre","dist":{"tarball":"http://registry.npmjs.org/underscore/-/underscore-1.0.3.tgz"},"directories":{},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}]},"1.0.4":{"name":"underscore","description":"Functional programming aid for JavaScript. Works well with jQuery.","url":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"lib":".","main":"underscore","version":"1.0.4","_id":"underscore@1.0.4","engines":{"node":"*"},"_nodeSupported":true,"_npmVersion":"0.2.7-2","_nodeVersion":"v0.3.1-pre","dist":{"tarball":"http://registry.npmjs.org/underscore/-/underscore-1.0.4.tgz"},"directories":{},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}]},"1.1.0":{"name":"underscore","description":"Functional programming aid for JavaScript. Works well with jQuery.","url":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"lib":".","main":"underscore","version":"1.1.0","_id":"underscore@1.1.0","engines":{"node":"*"},"_nodeSupported":true,"_npmVersion":"0.2.7-2","_nodeVersion":"v0.3.1-pre","dist":{"tarball":"http://registry.npmjs.org/underscore/-/underscore-1.1.0.tgz"},"directories":{},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}]},"1.1.1":{"name":"underscore","description":"Functional programming aid for JavaScript. Works well with jQuery.","url":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"lib":".","main":"underscore","version":"1.1.1","_id":"underscore@1.1.1","engines":{"node":"*"},"_nodeSupported":true,"_npmVersion":"0.2.7-2","_nodeVersion":"v0.3.1-pre","dist":{"tarball":"http://registry.npmjs.org/underscore/-/underscore-1.1.1.tgz"},"directories":{},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}]},"1.1.2":{"name":"underscore","description":"Functional programming aid for JavaScript. Works well with jQuery.","url":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"lib":".","main":"underscore","version":"1.1.2","_id":"underscore@1.1.2","engines":{"node":"*"},"_nodeSupported":true,"_npmVersion":"0.2.7-2","_nodeVersion":"v0.3.1-pre","dist":{"tarball":"http://registry.npmjs.org/underscore/-/underscore-1.1.2.tgz"},"directories":{},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}]},"1.1.3":{"name":"underscore","description":"Functional programming aid for JavaScript. Works well with jQuery.","url":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"lib":".","main":"underscore","version":"1.1.3","_id":"underscore@1.1.3","engines":{"node":"*"},"_nodeSupported":true,"_npmVersion":"0.2.8-1","_nodeVersion":"v0.2.5","dist":{"tarball":"http://registry.npmjs.org/underscore/-/underscore-1.1.3.tgz"},"directories":{},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}]},"1.1.4":{"name":"underscore","description":"Functional programming aid for JavaScript. Works well with jQuery.","url":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"lib":".","main":"underscore.js","version":"1.1.4","_id":"underscore@1.1.4","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"0.3.9","_nodeVersion":"v0.5.0-pre","dist":{"shasum":"9e82274902865625b3a6d4c315a38ffd80047dae","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.1.4.tgz"},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}},"1.1.5":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.1.5","_id":"underscore@1.1.5","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"0.3.16","_nodeVersion":"v0.4.2","directories":{},"files":[""],"_defaultsLoaded":true,"dist":{"shasum":"23601d62c75619998b2f0db24938102793336a56","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.1.5.tgz"},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}]},"1.1.6":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.1.6","_id":"underscore@1.1.6","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"0.3.18","_nodeVersion":"v0.4.2","directories":{},"files":[""],"_defaultsLoaded":true,"dist":{"shasum":"6868da1bdd72d75285be0b4e50f228e70d001a2c","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.1.6.tgz"},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}]},"1.1.7":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.1.7","devDependencies":{},"_id":"underscore@1.1.7","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.3","_nodeVersion":"v0.4.7","_defaultsLoaded":true,"dist":{"shasum":"40bab84bad19d230096e8d6ef628bff055d83db0","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.1.7.tgz"},"scripts":{},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}},"1.2.0":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.2.0","_npmJsonOpts":{"file":"/Users/jashkenas/.npm/underscore/1.2.0/package/package.json","wscript":false,"contributors":false,"serverjs":false},"_id":"underscore@1.2.0","devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.22","_nodeVersion":"v0.4.10","_defaultsLoaded":true,"dist":{"shasum":"b32ce32c8c118caa8031c10b54c7f65ab3b557fd","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.2.0.tgz"},"scripts":{},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"directories":{}},"1.2.1":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.2.1","_npmJsonOpts":{"file":"/Users/jashkenas/.npm/underscore/1.2.1/package/package.json","wscript":false,"contributors":false,"serverjs":false},"_id":"underscore@1.2.1","devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.22","_nodeVersion":"v0.4.10","_defaultsLoaded":true,"dist":{"shasum":"fc5c6b0765673d92a2d4ac8b4dc0aa88702e2bd4","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.2.1.tgz"},"scripts":{},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"directories":{}},"1.2.2":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.2.2","_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"_id":"underscore@1.2.2","devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.104","_nodeVersion":"v0.6.0","_defaultsLoaded":true,"dist":{"shasum":"74dd40e9face84e724eb2edae945b8aedc233ba3","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.2.2.tgz"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}},"1.2.3":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.2.3","_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"_id":"underscore@1.2.3","devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.104","_nodeVersion":"v0.6.0","_defaultsLoaded":true,"dist":{"shasum":"11b874da70f4683d7d48bba2b44be1e600d2f6cf","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.2.3.tgz"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}},"1.2.4":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.2.4","_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"_id":"underscore@1.2.4","dependencies":{},"devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.104","_nodeVersion":"v0.6.6","_defaultsLoaded":true,"dist":{"shasum":"e8da6241aa06f64df2473bb2590b8c17c84c3c7e","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.2.4.tgz"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}},"1.3.0":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.3.0","_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"_id":"underscore@1.3.0","dependencies":{},"devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.104","_nodeVersion":"v0.6.6","_defaultsLoaded":true,"dist":{"shasum":"253b2d79b7bb67943ced0fc744eb18267963ede8","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.3.0.tgz"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}},"1.3.1":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.3.1","_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"_id":"underscore@1.3.1","dependencies":{},"devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.104","_nodeVersion":"v0.6.6","_defaultsLoaded":true,"dist":{"shasum":"6cb8aad0e77eb5dbbfb54b22bcd8697309cf9641","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.3.1.tgz"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}},"1.3.2":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.3.2","_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"_id":"underscore@1.3.2","dependencies":{},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.1","_nodeVersion":"v0.6.11","_defaultsLoaded":true,"dist":{"shasum":"1b4e455089ab1d1d38ab6794ffe6cf08f764394a","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.3.2.tgz"},"readme":" __ \n /\\ \\ __ \n __ __ ___ \\_\\ \\ __ _ __ ____ ___ ___ _ __ __ /\\_\\ ____ \n /\\ \\/\\ \\ /' _ `\\ /'_ \\ /'__`\\/\\ __\\/ ,__\\ / ___\\ / __`\\/\\ __\\/'__`\\ \\/\\ \\ /',__\\ \n \\ \\ \\_\\ \\/\\ \\/\\ \\/\\ \\ \\ \\/\\ __/\\ \\ \\//\\__, `\\/\\ \\__//\\ \\ \\ \\ \\ \\//\\ __/ __ \\ \\ \\/\\__, `\\\n \\ \\____/\\ \\_\\ \\_\\ \\___,_\\ \\____\\\\ \\_\\\\/\\____/\\ \\____\\ \\____/\\ \\_\\\\ \\____\\/\\_\\ _\\ \\ \\/\\____/\n \\/___/ \\/_/\\/_/\\/__,_ /\\/____/ \\/_/ \\/___/ \\/____/\\/___/ \\/_/ \\/____/\\/_//\\ \\_\\ \\/___/ \n \\ \\____/ \n \\/___/\n \nUnderscore.js is a utility-belt library for JavaScript that provides \nsupport for the usual functional suspects (each, map, reduce, filter...) \nwithout extending any core JavaScript objects.\n\nFor Docs, License, Tests, and pre-packed downloads, see:\nhttp://documentcloud.github.com/underscore/\n\nMany thanks to our contributors:\nhttps://github.com/documentcloud/underscore/contributors\n","maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}},"1.3.3":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.3.3","_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"_id":"underscore@1.3.3","dependencies":{},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.1","_nodeVersion":"v0.6.11","_defaultsLoaded":true,"dist":{"shasum":"47ac53683daf832bfa952e1774417da47817ae42","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.3.3.tgz"},"readme":" __ \n /\\ \\ __ \n __ __ ___ \\_\\ \\ __ _ __ ____ ___ ___ _ __ __ /\\_\\ ____ \n /\\ \\/\\ \\ /' _ `\\ /'_ \\ /'__`\\/\\ __\\/ ,__\\ / ___\\ / __`\\/\\ __\\/'__`\\ \\/\\ \\ /',__\\ \n \\ \\ \\_\\ \\/\\ \\/\\ \\/\\ \\ \\ \\/\\ __/\\ \\ \\//\\__, `\\/\\ \\__//\\ \\ \\ \\ \\ \\//\\ __/ __ \\ \\ \\/\\__, `\\\n \\ \\____/\\ \\_\\ \\_\\ \\___,_\\ \\____\\\\ \\_\\\\/\\____/\\ \\____\\ \\____/\\ \\_\\\\ \\____\\/\\_\\ _\\ \\ \\/\\____/\n \\/___/ \\/_/\\/_/\\/__,_ /\\/____/ \\/_/ \\/___/ \\/____/\\/___/ \\/_/ \\/____/\\/_//\\ \\_\\ \\/___/ \n \\ \\____/ \n \\/___/\n \nUnderscore.js is a utility-belt library for JavaScript that provides \nsupport for the usual functional suspects (each, map, reduce, filter...) \nwithout extending any core JavaScript objects.\n\nFor Docs, License, Tests, and pre-packed downloads, see:\nhttp://documentcloud.github.com/underscore/\n\nMany thanks to our contributors:\nhttps://github.com/documentcloud/underscore/contributors\n","maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}}},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"time":{"1.0.3":"2011-12-07T15:12:18.045Z","1.0.4":"2011-12-07T15:12:18.045Z","1.1.0":"2011-12-07T15:12:18.045Z","1.1.1":"2011-12-07T15:12:18.045Z","1.1.2":"2011-12-07T15:12:18.045Z","1.1.3":"2011-12-07T15:12:18.045Z","1.1.4":"2011-12-07T15:12:18.045Z","1.1.5":"2011-12-07T15:12:18.045Z","1.1.6":"2011-12-07T15:12:18.045Z","1.1.7":"2011-12-07T15:12:18.045Z","1.2.0":"2011-12-07T15:12:18.045Z","1.2.1":"2011-12-07T15:12:18.045Z","1.2.2":"2011-11-14T20:28:47.115Z","1.2.3":"2011-12-07T15:12:18.045Z","1.2.4":"2012-01-09T17:23:14.818Z","1.3.0":"2012-01-11T16:41:38.459Z","1.3.1":"2012-01-23T22:57:36.474Z","1.3.2":"2012-04-09T18:38:14.345Z","1.3.3":"2012-04-10T14:43:48.089Z"},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"users":{"vesln":true,"mvolkmann":true,"lancehunt":true,"mikl":true,"linus":true,"vasc":true,"bat":true,"dmalam":true,"mbrevoort":true,"danielr":true,"rsimoes":true,"thlorenz":true}}
\ No newline at end of file diff --git a/deps/npm/node_modules/npm-registry-client/test/retries.js b/deps/npm/node_modules/npm-registry-client/test/retries.js new file mode 100644 index 0000000000..500abf29d9 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/test/retries.js @@ -0,0 +1,46 @@ +var tap = require('tap') +var server = require('./fixtures/server.js') +var RC = require('../') +var pkg = { _id: 'some-package@1.2.3', + name: 'some-package', + version: '1.2.3' } +var client = new RC({ + retries: 6 + , retryMinTimeout: 10 + , retryMaxTimeout: 100 + , cache: __dirname + '/fixtures/cache' + , registry: 'http://localhost:' + server.port }) + +tap.test('create new user account', function (t) { + // first time, return a 408 + server.expect('GET', '/some-package/1.2.3', function (req, res) { + res.statusCode = 408 + res.end('Timeout') + }) + // then, slam the door in their face + server.expect('GET', '/some-package/1.2.3', function (req, res) { + res.destroy() + }) + // then, blame someone else + server.expect('GET', '/some-package/1.2.3', function (req, res) { + res.statusCode = 502 + res.end('Gateway Timeout') + }) + // 'No one's home right now, come back later' + server.expect('GET', '/some-package/1.2.3', function (req, res) { + res.statusCode = 503 + res.setHeader('retry-after', '10') + res.end('Come back later') + }) + // finally, you may enter. + server.expect('GET', '/some-package/1.2.3', function (req, res) { + res.statusCode = 200 + res.json(pkg) + }) + + client.get('/some-package/1.2.3', function (er, data, raw, res) { + if (er) throw er + t.deepEqual(data, pkg) + t.end() + }) +}) diff --git a/deps/npm/node_modules/npm-registry-client/test/zz-cleanup.js b/deps/npm/node_modules/npm-registry-client/test/zz-cleanup.js new file mode 100644 index 0000000000..35253c7acd --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/test/zz-cleanup.js @@ -0,0 +1,10 @@ +var tap = require('tap') +var rimraf = require('rimraf') + +tap.test('teardown', function (t) { + rimraf(__dirname + '/fixtures/cache', function (er) { + if (er) throw er + t.pass('cache cleaned') + t.end() + }) +}) |