The Wayback Machine - https://web.archive.org/web/20250407172939/https://github.com/nodejs/node/commit/64d7ea9ce4
Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Commit 64d7ea9

Browse filesBrowse files
Trottaddaleax
authored andcommitted
test: refactor test-next-tick-error-spin
* use common.mustCall() * setTimeout() -> setImmediate() * assert() -> assert.strictEqual() * var -> const * remove unneeded console.log() * remove commented-out code PR-URL: #9537 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent d8eb4c2 commit 64d7ea9
Copy full SHA for 64d7ea9

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed
+11-14
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
'use strict';
2-
var common = require('../common');
3-
var assert = require('assert');
2+
const common = require('../common');
3+
const assert = require('assert');
44

55
if (process.argv[2] !== 'child') {
6-
var spawn = require('child_process').spawn;
7-
var child = spawn(process.execPath, [__filename, 'child'], {
6+
const spawn = require('child_process').spawn;
7+
const child = spawn(process.execPath, [__filename, 'child'], {
88
stdio: 'pipe'//'inherit'
99
});
10-
var timer = setTimeout(function() {
10+
const timer = setTimeout(function() {
1111
throw new Error('child is hung');
1212
}, common.platformTimeout(3000));
13-
child.on('exit', function(code) {
14-
console.error('ok');
15-
assert(!code);
13+
child.on('exit', common.mustCall(function(code) {
14+
assert.strictEqual(code, 0);
1615
clearTimeout(timer);
17-
});
16+
}));
1817
} else {
1918

20-
var domain = require('domain');
21-
var d = domain.create();
19+
const domain = require('domain');
20+
const d = domain.create();
2221
process.maxTickDepth = 10;
2322

2423
// in the error handler, we trigger several MakeCallback events
@@ -40,10 +39,8 @@ if (process.argv[2] !== 'child') {
4039
}
4140

4241
f();
43-
setTimeout(function() {
42+
setImmediate(function() {
4443
console.error('broke in!');
45-
//process.stdout.close();
46-
//process.stderr.close();
4744
process.exit(0);
4845
});
4946
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.