Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
Add an already-passing test for Node.js domain support.
Browse files Browse the repository at this point in the history
Closes #120.
  • Loading branch information
domenic committed Nov 25, 2012
1 parent 8463478 commit be00395
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions spec/q-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1694,6 +1694,33 @@ describe("node support", function () {

});

if (typeof process === "object" && process && typeof require === "function") {
describe("node domain support", function () {
it("should work", function (done) {
var error = new Error("should be caught by the domain's handler");
var domain = require("domain").create();

domain.run(function () {
Q.resolve().then(function () {
setTimeout(function () {
throw error;
}, 10);
});
});

var errorTimeout = setTimeout(function () {
done(new Error("Wasn't caught"));
}, 100);

domain.on("error", function (theError) {
expect(theError).toBe(error);
clearTimeout(errorTimeout);
done();
});
});
});
}

describe("decorator functions", function () {
describe("promised", function () {
var exception = new Error("That is not the meaning of life.");
Expand Down

0 comments on commit be00395

Please sign in to comment.