Skip to content

Commit e371233

Browse files
scalkpdevMylesBorins
scalkpdev
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 63f571e commit e371233

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-
var common = require('../common');
3-
var assert = require('assert');
4-
var path = require('path');
5-
var childProcess = require('child_process');
6-
var fs = require('fs');
2+
const common = require('../common');
3+
const assert = require('assert');
4+
const path = require('path');
5+
const childProcess = require('child_process');
6+
const fs = require('fs');
77

8-
var scriptString = path.join(common.fixturesDir, 'print-chars.js');
9-
var scriptBuffer = path.join(common.fixturesDir, 'print-chars-from-buffer.js');
10-
var tmpFile = path.join(common.tmpDir, 'stdout.txt');
8+
const scriptString = path.join(common.fixturesDir, 'print-chars.js');
9+
const scriptBuffer = path.join(common.fixturesDir,
10+
'print-chars-from-buffer.js');
11+
const tmpFile = 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) throw err;
3132

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

3435
var stat = 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
var finished = false;

0 commit comments

Comments
 (0)