@@ -132,38 +132,20 @@ function checkDomains() {
132132 }));
133133 }), 1);
134134
135- // Make sure nextTick, setImmediate and setTimeout can all recover properly
136- // after a thrown makeCallback call.
137- process.nextTick(common.mustCall(function() {
135+ function testTimer(id) {
136+ // Make sure nextTick, setImmediate and setTimeout can all recover properly
137+ // after a thrown makeCallback call.
138138 const d = domain.create();
139139 d.on('error', common.mustCall(function(e) {
140- assert.strictEqual(e.message, ' throw from domain 3' );
140+ assert.strictEqual(e.message, ` throw from domain ${id}` );
141141 }));
142142 makeCallback({domain: d}, function() {
143- throw new Error(' throw from domain 3' );
143+ throw new Error(` throw from domain ${id}` );
144144 });
145145 throw new Error('UNREACHABLE');
146- }));
146+ }
147147
148- setImmediate(common.mustCall(function() {
149- const d = domain.create();
150- d.on('error', common.mustCall(function(e) {
151- assert.strictEqual(e.message, 'throw from domain 2');
152- }));
153- makeCallback({domain: d}, function() {
154- throw new Error('throw from domain 2');
155- });
156- throw new Error('UNREACHABLE');
157- }));
158-
159- setTimeout(common.mustCall(function() {
160- const d = domain.create();
161- d.on('error', common.mustCall(function(e) {
162- assert.strictEqual(e.message, 'throw from domain 1');
163- }));
164- makeCallback({domain: d}, function() {
165- throw new Error('throw from domain 1');
166- });
167- throw new Error('UNREACHABLE');
168- }));
148+ process.nextTick(common.mustCall(testTimer), 3);
149+ setImmediate(common.mustCall(testTimer), 2);
150+ setTimeout(common.mustCall(testTimer), 1, 1);
169151}
0 commit comments