From 626d59f7a63baef7e9a6b143f0e0f104b901a2a5 Mon Sep 17 00:00:00 2001 From: scalkpdev Date: Thu, 1 Dec 2016 10:42:27 -0600 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/9939 Reviewed-By: Prince John Wesley Reviewed-By: James M Snell --- test/parallel/test-stdout-to-file.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/test/parallel/test-stdout-to-file.js b/test/parallel/test-stdout-to-file.js index 5dce369aad..10391c481a 100644 --- a/test/parallel/test-stdout-to-file.js +++ b/test/parallel/test-stdout-to-file.js @@ -1,13 +1,14 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var path = require('path'); -var childProcess = require('child_process'); -var fs = require('fs'); +const common = require('../common'); +const assert = require('assert'); +const path = require('path'); +const childProcess = require('child_process'); +const fs = require('fs'); -var scriptString = path.join(common.fixturesDir, 'print-chars.js'); -var scriptBuffer = path.join(common.fixturesDir, 'print-chars-from-buffer.js'); -var tmpFile = path.join(common.tmpDir, 'stdout.txt'); +const scriptString = path.join(common.fixturesDir, 'print-chars.js'); +const scriptBuffer = path.join(common.fixturesDir, + 'print-chars-from-buffer.js'); +const tmpFile = path.join(common.tmpDir, 'stdout.txt'); common.refreshTmpDir(); @@ -24,22 +25,22 @@ function test(size, useBuffer, cb) { fs.unlinkSync(tmpFile); } catch (e) {} - console.log(size + ' chars to ' + tmpFile + '...'); + console.log(`${size} chars to ${tmpFile}...`); - childProcess.exec(cmd, function(err) { + childProcess.exec(cmd, common.mustCall(function(err) { if (err) throw err; console.log('done!'); var stat = fs.statSync(tmpFile); - console.log(tmpFile + ' has ' + stat.size + ' bytes'); + console.log(`${tmpFile} has ${stat.size} bytes`); - assert.equal(size, stat.size); + assert.strictEqual(size, stat.size); fs.unlinkSync(tmpFile); cb(); - }); + })); } test(1024 * 1024, false, common.mustCall(function() {