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
diff options
context:
space:
mode:
authorForrest L Norvell <forrest@npmjs.com>2015-04-08 22:20:47 +0300
committerForrest L Norvell <forrest@npmjs.com>2015-04-08 22:20:47 +0300
commit269a62327bbe114583f3666c61fcbe81d17a1e57 (patch)
treed1b9bbbbcce3941f413e90f129189811af68afba
parent2ef88989c41bee1578570bb2172c90ede129dbd1 (diff)
test: monkeypatch setImmediate globally for nock
This is probably a sign that we shouldn't be using new versions of `nock` in these tests if 0.8 is a concern.
-rw-r--r--test/common-tap.js8
-rw-r--r--test/tap/publish-scoped.js8
2 files changed, 8 insertions, 8 deletions
diff --git a/test/common-tap.js b/test/common-tap.js
index b33d3cb16..27c828f16 100644
--- a/test/common-tap.js
+++ b/test/common-tap.js
@@ -1,3 +1,11 @@
+// cheesy hackaround for test deps (read: nock) that rely on setImmediate
+if (!global.setImmediate || !require('timers').setImmediate) {
+ require('timers').setImmediate = global.setImmediate = function () {
+ var args = [arguments[0], 0].concat([].slice.call(arguments, 1))
+ setTimeout.apply(this, args)
+ }
+}
+
var spawn = require("child_process").spawn
var path = require("path")
diff --git a/test/tap/publish-scoped.js b/test/tap/publish-scoped.js
index 2658c8dd2..f74ca2e61 100644
--- a/test/tap/publish-scoped.js
+++ b/test/tap/publish-scoped.js
@@ -11,14 +11,6 @@ var common = require("../common-tap.js")
var pkg = path.join(__dirname, "prepublish_package")
-// TODO: nock uses setImmediate, breaks 0.8: replace with mockRegistry
-if (!global.setImmediate) {
- global.setImmediate = function () {
- var args = [arguments[0], 0].concat([].slice.call(arguments, 1))
- setTimeout.apply(this, args)
- }
-}
-
test("setup", function (t) {
mkdirp(path.join(pkg, "cache"), next)