Skip to content

Commit 7d61bbf

Browse 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

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
'use strict';
2-
require('../common');
3-
varassert=require('assert');
2+
constcommon=require('../common');
3+
constassert=require('assert');
44

5-
varspawn=require('child_process').spawn;
6-
varchild=spawn(process.execPath,[],{
5+
constspawn=require('child_process').spawn;
6+
constchild=spawn(process.execPath,[],{
77
env: Object.assign(process.env,{
88
NODE_DEBUG: process.argv[2]
99
})
1010
});
11-
varwanted=child.pid+'\n';
11+
constwanted=child.pid+'\n';
1212
varfound='';
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)