-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for async tests, though not in ideal fashion due to moch…
…a lacking support for async skip (mochajs/mocha#1625)
- Loading branch information
1 parent
d6979af
commit 01314d3
Showing
4 changed files
with
61 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// From http://stackoverflow.com/questions/14301839/javascript-asynchronous-exception-handling-with-node-js | ||
|
||
var domain = require("domain"); | ||
module.exports = function (func) { | ||
var F = function () { }; | ||
var dom = domain.create(); | ||
F.prototype.catch = function (errHandle) { | ||
var args = arguments; | ||
dom.on("error", function (err) { | ||
return errHandle(err, dom); | ||
}).run(function () { | ||
func.call(null, args); | ||
}); | ||
return this; | ||
}; | ||
return new F(); | ||
}; |