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:
authorMichael Hayes <mhayes@newrelic.com>2015-05-13 01:56:15 +0300
committerForrest L Norvell <forrest@npmjs.com>2015-05-15 01:01:53 +0300
commitdc7752013ffce13a3d3f13e518a0052c22fc1158 (patch)
tree2ddda1845b91147eb517a0d5455d31c7a7a453b9 /test
parent048aca3ee3c977e21db21a1c63ad2f9501d11e99 (diff)
cache: fix error messages for private registries
Diffstat (limited to 'test')
-rw-r--r--test/tap/404-private-registry.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/tap/404-private-registry.js b/test/tap/404-private-registry.js
new file mode 100644
index 000000000..9e05f483e
--- /dev/null
+++ b/test/tap/404-private-registry.js
@@ -0,0 +1,22 @@
+var nock = require('nock')
+var test = require('tap').test
+var npm = require('../../')
+var addNamed = require('../../lib/cache/add-named')
+
+test('package names not mangled on error with non-root registry', function test404 (t) {
+ nock('http://localhost:1337')
+ .get('/registry/foo')
+ .reply(404, {
+ error: 'not_found',
+ reason: 'document not found'
+ })
+
+ npm.load({registry: 'http://localhost:1337/registry', global: true}, function () {
+ addNamed('foo', '*', null, function checkError (err) {
+ t.ok(err, 'should error')
+ t.equal(err.message, '404 Not Found: foo', 'should have package name in error')
+ t.equal(err.pkgid, 'foo', 'err.pkgid should match package name')
+ t.end()
+ })
+ })
+})