Skip to content
This repository was archived by the owner on Aug 11, 2022. It is now read-only.

Commit 0e8d473

Browse files
robertkowalskiothiym23
authored andcommitted
npm-registry-mock@1.0.0
* npm-registry-mock now sets `connection: close` for registry requests to complement change to `npm-registry-client` that sets `connection: keep-alive` by default * functions that talk to hock are now 'plugins' instead of overloading mocks * mock responses are no longer deserialized on receiving side * callback passed to mock-registry now follows error-first convention closes npm/npm-registry-mock#25
1 parent bca3085 commit 0e8d473

50 files changed

Lines changed: 95 additions & 81 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
"marked-man": "~0.1.4",
170170
"nock": "~0.59.0",
171171
"npm-registry-couchapp": "~2.6.2",
172-
"npm-registry-mock": "~0.6.3",
172+
"npm-registry-mock": "~1.0.0",
173173
"require-inject": "~1.1.0",
174174
"tap": "~0.5.0"
175175
},

‎test/disabled/outdated-depth-integer.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ test('outdated depth integer', function (t) {
2424

2525
process.chdir(pkg)
2626

27-
mr(common.port, function (s) {
27+
mr({port : common.port}, function (s) {
2828
npm.load({
2929
cache: pkg + '/cache'
3030
, loglevel: 'silent'
@@ -49,4 +49,4 @@ test('outdated depth integer', function (t) {
4949
test("cleanup", function (t) {
5050
cleanup()
5151
t.end()
52-
})
52+
})

‎test/tap/404-parent.js‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,13 @@ function setup() {
4040
process.chdir(pkg)
4141
}
4242

43-
function performInstall(cb) {
44-
mr(common.port, function (s) { // create mock registry.
43+
function plugin (server) {
44+
server.get("/test-npm-404-parent-test")
45+
.reply(404, {"error": "version not found"})
46+
}
47+
48+
function performInstall (cb) {
49+
mr({port : common.port, plugin : plugin}, function (er, s) { // create mock registry.
4550
npm.load({registry: common.registry}, function () {
4651
npm.commands.install(pkg, [], function (err) {
4752
cb(err)

‎test/tap/access.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ test("setup", function (t) {
3030
mkdirp(pkg, function (er) {
3131
t.ifError(er, pkg + " made successfully")
3232

33-
mr({port : common.port, mocks : mocks}, function (s) {
33+
mr({port : common.port, plugin : mocks}, function (err, s) {
3434
server = s
3535

3636
fs.writeFile(

‎test/tap/adduser-always-auth.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function mocks(server) {
2525
}
2626

2727
test("npm login", function (t) {
28-
mr({port : common.port, mocks : mocks}, function (s) {
28+
mr({port : common.port, plugin : mocks}, function (er, s) {
2929
var runner = common.npm(
3030
[
3131
"login",
@@ -61,7 +61,7 @@ test("npm login", function (t) {
6161
})
6262

6363
test("npm login --always-auth", function (t) {
64-
mr({port : common.port, mocks : mocks}, function (s) {
64+
mr({port : common.port, plugin : mocks}, function (er, s) {
6565
var runner = common.npm(
6666
[
6767
"login",
@@ -98,7 +98,7 @@ test("npm login --always-auth", function (t) {
9898
})
9999

100100
test("npm login --no-always-auth", function (t) {
101-
mr({port : common.port, mocks : mocks}, function (s) {
101+
mr({port : common.port, plugin : mocks}, function (er, s) {
102102
var runner = common.npm(
103103
[
104104
"login",

‎test/tap/adduser-legacy-auth.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ test("setup", function (t) {
4747
})
4848

4949
test("npm login", function (t) {
50-
mr({port : common.port, mocks : mocks}, function (s) {
50+
mr({port : common.port, plugin : mocks}, function (er, s) {
5151
var runner = common.npm(
5252
[
5353
"login",

‎test/tap/bugs.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ test("setup", function (t) {
2525
})
2626

2727
test("npm bugs underscore", function (t) {
28-
mr(common.port, function (s) {
28+
mr({port : common.port}, function (er, s) {
2929
common.npm([
3030
"bugs", "underscore",
3131
"--registry=" + common.registry,
@@ -45,7 +45,7 @@ test("npm bugs underscore", function (t) {
4545
})
4646

4747
test("npm bugs optimist - github (https://)", function (t) {
48-
mr(common.port, function (s) {
48+
mr({port : common.port}, function (er, s) {
4949
common.npm([
5050
"bugs", "optimist",
5151
"--registry=" + common.registry,
@@ -65,7 +65,7 @@ test("npm bugs optimist - github (https://)", function (t) {
6565
})
6666

6767
test("npm bugs npm-test-peer-deps - no repo", function (t) {
68-
mr(common.port, function (s) {
68+
mr({port : common.port}, function (er, s) {
6969
common.npm([
7070
"bugs", "npm-test-peer-deps",
7171
"--registry=" + common.registry,
@@ -85,7 +85,7 @@ test("npm bugs npm-test-peer-deps - no repo", function (t) {
8585
})
8686

8787
test("npm bugs test-repo-url-http - non-github (http://)", function (t) {
88-
mr(common.port, function (s) {
88+
mr({port : common.port}, function (er, s) {
8989
common.npm([
9090
"bugs", "test-repo-url-http",
9191
"--registry=" + common.registry,
@@ -105,7 +105,7 @@ test("npm bugs test-repo-url-http - non-github (http://)", function (t) {
105105
})
106106

107107
test("npm bugs test-repo-url-https - non-github (https://)", function (t) {
108-
mr(common.port, function (s) {
108+
mr({port : common.port}, function (er, s) {
109109
common.npm([
110110
"bugs", "test-repo-url-https",
111111
"--registry=" + common.registry,
@@ -125,7 +125,7 @@ test("npm bugs test-repo-url-https - non-github (https://)", function (t) {
125125
})
126126

127127
test("npm bugs test-repo-url-ssh - non-github (ssh://)", function (t) {
128-
mr(common.port, function (s) {
128+
mr({port : common.port}, function (er, s) {
129129
common.npm([
130130
"bugs", "test-repo-url-ssh",
131131
"--registry=" + common.registry,

‎test/tap/cache-shasum-fork.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ test("mock reg", function (t) {
1616
mkdirp.sync(cache)
1717
rimraf.sync(cwd)
1818
mkdirp.sync(path.join(cwd, "node_modules"))
19-
mr(common.port, function (s) {
19+
mr({port : common.port}, function (er, s) {
2020
server = s
2121
t.pass("ok")
2222
t.end()

‎test/tap/cache-shasum.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var server
1313
test("mock reg", function (t) {
1414
rimraf.sync(cache)
1515
mkdirp.sync(cache)
16-
mr(common.port, function (s) {
16+
mr({port : common.port}, function (er, s) {
1717
server = s
1818
t.pass("ok")
1919
t.end()

‎test/tap/circular-dep.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function setup (cb) {
3535
process.chdir(path.resolve(pkg, "minimist"))
3636

3737
fs.mkdirSync(path.resolve(pkg, "minimist/node_modules"))
38-
mr(common.port, function (s) {
38+
mr({port : common.port}, function (er, s) {
3939
server = s
4040
npm.load({
4141
loglevel: "silent",

0 commit comments

Comments
 (0)