Skip to content

Instantly share code, notes, and snippets.

@mcollina
Last active December 10, 2015 13:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcollina/4443963 to your computer and use it in GitHub Desktop.
Save mcollina/4443963 to your computer and use it in GitHub Desktop.
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
pids
logs
results
node_modules
npm-debug.log
var domain = require("domain");
var _ = require("underscore");
describe("nodejs domains", function() {
var d;
var uncaughtExceptionHandler;
beforeEach(function() {
d = domain.create();
uncaughtExceptionHandler = _.last(process.listeners("uncaughtException"));
process.removeListener("uncaughtException", uncaughtExceptionHandler);
});
afterEach(function() {
d.dispose();
process.on("uncaughtException", uncaughtExceptionHandler);
});
it("should work!", function(done) {
d.run(function() {
process.nextTick(function() {
throw new Error("eheheh");
});
});
d.on("error", function(err) {
done();
});
});
});
{
"name": "mocha-domain-bug",
"version": "0.0.1",
"scripts": {
"test": "make test"
},
"author": "Matteo Collina <hello@matteocollina.com>",
"license": "MIT",
"devDependencies": {
"mocha": "~1.7.0",
"chai": "~1.3.0"
},
"dependencies": {
"underscore": "~1.4.3"
}
}
var domain = require("domain");
var d = domain.create();
d.on("error", function(err) {
console.log(err);
});
d.run(function() {
process.nextTick(function() {
throw new Error("eheheh");
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment