mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
33 lines
709 B
JavaScript
Executable File
33 lines
709 B
JavaScript
Executable File
var Promise = require('../')
|
|
, Domain = require('domain')
|
|
, assert = require('assert');
|
|
|
|
var next = 'function' == typeof setImmediate
|
|
? setImmediate
|
|
: process.nextTick;
|
|
|
|
describe("domains", function () {
|
|
it("exceptions should not breakout of domain bounderies", function (done) {
|
|
if (process.version.indexOf('v0.8') == 0) return done();
|
|
var d = Domain.create();
|
|
d.once('error', function (err) {
|
|
assert.equal(err.message, 'gaga');
|
|
done()
|
|
});
|
|
|
|
var p = new Promise();
|
|
|
|
d.run(function () {
|
|
p.then(function () {
|
|
|
|
}).then(function () {
|
|
throw new Error('gaga');
|
|
}).end();
|
|
});
|
|
|
|
next(function () {
|
|
p.fulfill();
|
|
})
|
|
});
|
|
});
|