continuation-local-storage
Advanced tools
Comparing version 2.3.4 to 2.4.0
@@ -188,3 +188,4 @@ 'use strict'; | ||
before : function (context, domain) { namespace.enter(domain); }, | ||
after : function (context, domain) { namespace.exit(domain); } | ||
after : function (context, domain) { namespace.exit(domain); }, | ||
error : function (domain) { namespace.exit(domain); } | ||
} | ||
@@ -191,0 +192,0 @@ ); |
{ | ||
"name": "continuation-local-storage", | ||
"version": "2.3.4", | ||
"version": "2.4.0", | ||
"description": "userland implementation of https://github.com/joyent/node/issues/5243", | ||
@@ -34,3 +34,3 @@ "main": "context.js", | ||
"optionalDependencies": { | ||
"async-listener": ">=0.2.0" | ||
"async-listener": ">=0.2.2" | ||
}, | ||
@@ -37,0 +37,0 @@ "dependencies": { |
@@ -5,66 +5,53 @@ 'use strict'; | ||
if (!process.addAsyncListener) { | ||
test("overwriting startup.processNextTick", function (t) { | ||
t.plan(2); | ||
t.doesNotThrow(function () { require('../context.js'); }); | ||
test("overwriting startup.processNextTick", function (t) { | ||
t.plan(2); | ||
t.ok(process.nextTick.__wrapped, "should wrap process.nextTick()"); | ||
}); | ||
t.doesNotThrow(function () { require('../context.js'); }); | ||
test("overwriting domain helpers", function (t) { | ||
// domain helpers were only in 0.10.x | ||
if (!(process._nextDomainTick || | ||
process._tickDomainCallback)) { | ||
return t.end(); | ||
} | ||
t.ok(process.nextTick.__wrapped, "should wrap process.nextTick()"); | ||
}); | ||
t.plan(2); | ||
test("overwriting domain helpers", function (t) { | ||
// domain helpers were only in 0.10.x | ||
if (!(process._nextDomainTick || | ||
process._tickDomainCallback)) { | ||
return t.end(); | ||
} | ||
t.ok(process._nextDomainTick.__wrapped, | ||
"should wrap process._nextDomainTick()"); | ||
t.ok(process._tickDomainCallback.__wrapped, | ||
"should wrap process._tickDomainCallback()"); | ||
}); | ||
t.plan(2); | ||
test("overwriting timers", function (t) { | ||
t.plan(2); | ||
t.ok(process._nextDomainTick.__wrapped, | ||
"should wrap process._nextDomainTick()"); | ||
t.ok(process._tickDomainCallback.__wrapped, | ||
"should wrap process._tickDomainCallback()"); | ||
}); | ||
var timers = require('timers'); | ||
t.ok(timers.setTimeout.__wrapped, "should wrap setTimeout()"); | ||
t.ok(timers.setInterval.__wrapped, "should wrap setInterval()"); | ||
test("overwriting timers", function (t) { | ||
t.plan(6); | ||
/* It would be nice to test that monkeypatching preserves the status quo | ||
* ante, but assert thinks setTimeout !== global.setTimeout (why?) and both of | ||
* those are a wrapper around NativeModule.require("timers").setTimeout, | ||
* presumably to try to prevent the kind of "fun" I'm having here. | ||
*/ | ||
}); | ||
t.ok(setTimeout.__wrapped, "should wrap setTimeout()"); | ||
t.ok(setInterval.__wrapped, "should wrap setInterval()"); | ||
test("overwriting setImmediate", function (t) { | ||
// setTimeout's a johnny-come-lately | ||
if (!global.setImmediate) return t.end(); | ||
t.ok(global.setTimeout.__wrapped, "should also wrap global setTimeout()"); | ||
t.ok(global.setInterval.__wrapped, "should also wrap global setInterval()"); | ||
t.plan(1); | ||
var timers = require('timers'); | ||
t.ok(timers.setTimeout.__wrapped, "should wrap setTimeout()"); | ||
t.ok(timers.setInterval.__wrapped, "should wrap setInterval()"); | ||
t.ok(require('timers').setImmediate.__wrapped, "should wrap setImmediate()"); | ||
/* It would be nice to test that monkeypatching preserves the status quo | ||
* ante, but assert thinks setTimeout !== global.setTimeout (why?) and both of | ||
* those are a wrapper around NativeModule.require("timers").setTimeout, | ||
* presumably to try to prevent the kind of "fun" I'm having here. | ||
*/ | ||
}); | ||
test("overwriting setImmediate", function (t) { | ||
// setTimeout's a johnny-come-lately | ||
if (!global.setImmediate) return t.end(); | ||
t.plan(3); | ||
t.ok(setImmediate.__wrapped, "should wrap setImmediate()"); | ||
t.ok(global.setImmediate.__wrapped, "should also wrap global setImmediate()"); | ||
t.ok(require('timers').setImmediate.__wrapped, "should wrap setImmediate()"); | ||
/* It would be nice to test that monkeypatching preserves the status quo | ||
* ante, but assert thinks setTimeout !== global.setTimeout (why?) and both of | ||
* those are a wrapper around NativeModule.require("timers").setTimeout, | ||
* presumably to try to prevent the kind of "fun" I'm having here. | ||
*/ | ||
}); | ||
/* It would be nice to test that monkeypatching preserves the status quo | ||
* ante, but assert thinks setTimeout !== global.setTimeout (why?) and both of | ||
* those are a wrapper around NativeModule.require("timers").setTimeout, | ||
* presumably to try to prevent the kind of "fun" I'm having here. | ||
*/ | ||
}); | ||
} |
77930
1867