Last active
December 10, 2015 13:58
-
-
Save mcollina/4443963 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lib-cov | |
*.seed | |
*.log | |
*.csv | |
*.dat | |
*.out | |
*.pid | |
*.gz | |
pids | |
logs | |
results | |
node_modules | |
npm-debug.log |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
}); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "mocha-domain-bug", | |
"version": "0.0.1", | |
"scripts": { | |
"test": "make test" | |
}, | |
"author": "Matteo Collina <[email protected]>", | |
"license": "MIT", | |
"devDependencies": { | |
"mocha": "~1.7.0", | |
"chai": "~1.3.0" | |
}, | |
"dependencies": { | |
"underscore": "~1.4.3" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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