Skip to content

Commit 626d59f

Browse files
scalkpdevaddaleax
authored andcommitted
test: update test-stdout-to-file
* changed vars to const * changed assert.equal to assert.strictEqual * added a common.mustCall in the childProcess.exec callback * replaced 2 console.log strings with template strings for readability * had to break up line 9 because it was causing a line max length (80) listing err PR-URL: #9939 Reviewed-By: Prince John Wesley <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 223ec17 commit 626d59f

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

‎test/parallel/test-stdout-to-file.js‎

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
'use strict';
2-
varcommon=require('../common');
3-
varassert=require('assert');
4-
varpath=require('path');
5-
varchildProcess=require('child_process');
6-
varfs=require('fs');
2+
constcommon=require('../common');
3+
constassert=require('assert');
4+
constpath=require('path');
5+
constchildProcess=require('child_process');
6+
constfs=require('fs');
77

8-
varscriptString=path.join(common.fixturesDir,'print-chars.js');
9-
varscriptBuffer=path.join(common.fixturesDir,'print-chars-from-buffer.js');
10-
vartmpFile=path.join(common.tmpDir,'stdout.txt');
8+
constscriptString=path.join(common.fixturesDir,'print-chars.js');
9+
constscriptBuffer=path.join(common.fixturesDir,
10+
'print-chars-from-buffer.js');
11+
consttmpFile=path.join(common.tmpDir,'stdout.txt');
1112

1213
common.refreshTmpDir();
1314

@@ -24,22 +25,22 @@ function test(size, useBuffer, cb){
2425
fs.unlinkSync(tmpFile);
2526
}catch(e){}
2627

27-
console.log(size+' chars to '+tmpFile+'...');
28+
console.log(`${size}chars to ${tmpFile}...`);
2829

29-
childProcess.exec(cmd,function(err){
30+
childProcess.exec(cmd,common.mustCall(function(err){
3031
if(err)throwerr;
3132

3233
console.log('done!');
3334

3435
varstat=fs.statSync(tmpFile);
3536

36-
console.log(tmpFile+' has '+stat.size+' bytes');
37+
console.log(`${tmpFile}has ${stat.size}bytes`);
3738

38-
assert.equal(size,stat.size);
39+
assert.strictEqual(size,stat.size);
3940
fs.unlinkSync(tmpFile);
4041

4142
cb();
42-
});
43+
}));
4344
}
4445

4546
test(1024*1024,false,common.mustCall(function(){

0 commit comments

Comments
(0)