Skip to content

Navigation Menu

Sign in
Appearance settings

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

Appearance settings

Commit 7d61bbf

Browse filesBrowse files
emanuelbuholzerMylesBorins
authored andcommitted
test: refactor test-stdin-script-child
- var -> const where possible - assert.equal -> assert.strictEqual - passed the setTimeout function a second parameter for readability - used assert.strictEqual for assert(!c) as it is expected to be 0 and not some other value PR-URL: #10321 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com>
1 parent 76bb3cb commit 7d61bbf
Copy full SHA for 7d61bbf

File tree

Expand file treeCollapse file tree

1 file changed

+10
-10
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-10
lines changed
Open diff view settings
Collapse file
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
'use strict';
2-
require('../common');
3-
var assert = require('assert');
2+
const common = require('../common');
3+
const assert = require('assert');
44

5-
var spawn = require('child_process').spawn;
6-
var child = spawn(process.execPath, [], {
5+
const spawn = require('child_process').spawn;
6+
const child = spawn(process.execPath, [], {
77
env: Object.assign(process.env, {
88
NODE_DEBUG: process.argv[2]
99
})
1010
});
11-
var wanted = child.pid + '\n';
11+
const wanted = child.pid + '\n';
1212
var found = '';
1313

1414
child.stdout.setEncoding('utf8');
@@ -21,12 +21,12 @@ child.stderr.on('data', function(c) {
2121
console.error('> ' + c.trim().split(/\n/).join('\n> '));
2222
});
2323

24-
child.on('close', function(c) {
25-
assert(!c);
26-
assert.equal(found, wanted);
24+
child.on('close', common.mustCall(function(c) {
25+
assert.strictEqual(c, 0);
26+
assert.strictEqual(found, wanted);
2727
console.log('ok');
28-
});
28+
}));
2929

3030
setTimeout(function() {
3131
child.stdin.end('console.log(process.pid)');
32-
});
32+
}, 1);

0 commit comments

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