continuation-local-storage
Advanced tools
Comparing version 3.2.0 to 3.2.1
@@ -73,3 +73,3 @@ 'use strict'; | ||
if (!this.active) { | ||
context = Object.create(this.active); | ||
context = this.createContext(); | ||
} | ||
@@ -76,0 +76,0 @@ else { |
{ | ||
"name": "continuation-local-storage", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"description": "userland implementation of https://github.com/joyent/node/issues/5243", | ||
@@ -31,8 +31,9 @@ "main": "context.js", | ||
"devDependencies": { | ||
"tap": "^6.3.2" | ||
"semver": "^5.4.1", | ||
"tap": "^10.3.1" | ||
}, | ||
"dependencies": { | ||
"async-listener": "^0.6.0", | ||
"emitter-listener": "^1.0.1" | ||
"emitter-listener": "^1.1.1" | ||
} | ||
} |
'use strict'; | ||
var tap = require('tap') | ||
, semver = require('semver') | ||
, test = tap.test | ||
@@ -20,3 +21,3 @@ , createNamespace = require('../context.js').createNamespace | ||
t.test("deflate", function (t) { | ||
t.test("randomBytes", function (t) { | ||
namespace.run(function () { | ||
@@ -41,3 +42,3 @@ namespace.set('test', 42); | ||
t.test("deflate", function (t) { | ||
t.test("pseudoRandomBytes", function (t) { | ||
namespace.run(function () { | ||
@@ -62,10 +63,19 @@ namespace.set('test', 42); | ||
t.test("deflate", function (t) { | ||
t.test("pbkdf2", function (t) { | ||
namespace.run(function () { | ||
namespace.set('test', 42); | ||
crypto.pbkdf2("s3cr3tz", "451243", 10, 40, function (err) { | ||
if (err) throw err; | ||
t.equal(namespace.get('test'), 42, "mutated state was preserved"); | ||
t.end(); | ||
}); | ||
// this API changed after 0.10.0, and errors if digest is missing after v6 | ||
if (semver.gte(process.version, "0.12.0")) { | ||
crypto.pbkdf2("s3cr3tz", "451243", 10, 40, "sha512", function (err) { | ||
if (err) throw err; | ||
t.equal(namespace.get('test'), 42, "mutated state was preserved"); | ||
t.end(); | ||
}); | ||
} else { | ||
crypto.pbkdf2("s3cr3tz", "451243", 10, 40, function (err) { | ||
if (err) throw err; | ||
t.equal(namespace.get('test'), 42, "mutated state was preserved"); | ||
t.end(); | ||
}); | ||
} | ||
}); | ||
@@ -72,0 +82,0 @@ }); |
@@ -14,2 +14,3 @@ 'use strict'; | ||
namespace.set('outer', true); | ||
namespace.bindEmitter(d); | ||
@@ -90,4 +91,5 @@ d.on('error', function (blerg) { | ||
var namespace = cls.createNamespace('cls@nexttick'); | ||
var d = domain.create(); | ||
namespace.bindEmitter(d); | ||
var d = domain.create(); | ||
d.on('error', function (e) { | ||
@@ -119,4 +121,5 @@ t.ok(namespace.fromException(e), "context was attached to error"); | ||
var namespace = cls.createNamespace('cls@nexttick'); | ||
var namespace = cls.createNamespace('cls@setTimeout'); | ||
var d = domain.create(); | ||
namespace.bindEmitter(d); | ||
@@ -128,3 +131,3 @@ d.on('error', function (e) { | ||
cls.destroyNamespace('cls@nexttick'); | ||
cls.destroyNamespace('cls@setTimeout'); | ||
}); | ||
@@ -139,3 +142,3 @@ | ||
namespace.set('value', 'transaction set'); | ||
throw new Error("cls@nexttick explosion"); | ||
throw new Error("cls@setTimeout explosion"); | ||
}); | ||
@@ -142,0 +145,0 @@ })); |
@@ -82,3 +82,2 @@ 'use strict'; | ||
namespace.set('test', 0xabad1dea); | ||
t.test("fs.rename", function (t) { | ||
@@ -869,5 +868,8 @@ createFile(t); | ||
fs.watchFile(FILENAME, | ||
{persistent : false, interval : 20}, | ||
function (before, after) { | ||
var options = { | ||
persistent: true, | ||
interval: 20 | ||
}; | ||
fs.watchFile(FILENAME, options, function (before, after) { | ||
t.equal(namespace.get('test'), 'watchFile', | ||
@@ -874,0 +876,0 @@ "mutated state has persisted to fs.watchFile's callback"); |
'use strict'; | ||
// I love when a tap.plan() comes together | ||
console.log('1..1'); | ||
process.on('uncaughtException', function (err) { | ||
@@ -4,0 +7,0 @@ if (err.message === 'oops') { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
102612
2265
4
2
27
Updatedemitter-listener@^1.1.1