From acdce8bbf9cd4e35decc31421a48c2609c40db34 Mon Sep 17 00:00:00 2001 From: Travis Bretton Date: Thu, 1 Dec 2016 10:45:24 -0700 Subject: [PATCH 1/2] test: assert.strictEqual and linting Updated assert.equal to assert.strictEqual Updated 'var' to 'const' --- test/parallel/test-pipe-head.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/parallel/test-pipe-head.js b/test/parallel/test-pipe-head.js index dcb4e89137f536..f77194e6bd0efb 100644 --- a/test/parallel/test-pipe-head.js +++ b/test/parallel/test-pipe-head.js @@ -1,17 +1,17 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); -var exec = require('child_process').exec; -var join = require('path').join; +const exec = require('child_process').exec; +const join = require('path').join; -var nodePath = process.argv[0]; -var script = join(common.fixturesDir, 'print-10-lines.js'); +const nodePath = process.argv[0]; +const script = join(common.fixturesDir, 'print-10-lines.js'); -var cmd = '"' + nodePath + '" "' + script + '" | head -2'; +const cmd = '"' + nodePath + '" "' + script + '" | head -2'; exec(cmd, common.mustCall(function(err, stdout, stderr) { if (err) throw err; - var lines = stdout.split('\n'); - assert.equal(3, lines.length); + const lines = stdout.split('\n'); + assert.strictEqual(3, lines.length); })); From 3eeb2bb6114bec1df169bfe98e63dfc1bab6e20b Mon Sep 17 00:00:00 2001 From: tlb Date: Thu, 22 Dec 2016 13:31:51 -0700 Subject: [PATCH 2/2] test: use string interpolation and assert.ifError --- test/parallel/test-pipe-head.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-pipe-head.js b/test/parallel/test-pipe-head.js index f77194e6bd0efb..c838be03aa9a01 100644 --- a/test/parallel/test-pipe-head.js +++ b/test/parallel/test-pipe-head.js @@ -8,10 +8,10 @@ const join = require('path').join; const nodePath = process.argv[0]; const script = join(common.fixturesDir, 'print-10-lines.js'); -const cmd = '"' + nodePath + '" "' + script + '" | head -2'; +const cmd = `"${nodePath}" "${script}" | head -2`; exec(cmd, common.mustCall(function(err, stdout, stderr) { - if (err) throw err; + assert.ifError(err); const lines = stdout.split('\n'); assert.strictEqual(3, lines.length); }));