summaryrefslogtreecommitdiff
path: root/test/sequential/test-child-process-execsync.js
diff options
context:
space:
mode:
authorGibson Fahnestock <gib@uk.ibm.com>2017-01-08 13:19:00 +0000
committerGibson Fahnestock <gib@uk.ibm.com>2017-01-11 11:43:52 +0000
commit7a0e462f9facfff8ccd7b37eb5b65db1c2b2f55f (patch)
treea971102d320e17e6cb3d00c48fe708b2b86c8136 /test/sequential/test-child-process-execsync.js
parent1ef401ce92d6195878b9d041cc969612628f5852 (diff)
downloadnode-new-7a0e462f9facfff8ccd7b37eb5b65db1c2b2f55f.tar.gz
test: use eslint to fix var->const/let
Manually fix issues that eslint --fix couldn't do automatically. PR-URL: https://github.com/nodejs/node/pull/10685 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
Diffstat (limited to 'test/sequential/test-child-process-execsync.js')
-rw-r--r--test/sequential/test-child-process-execsync.js23
1 files changed, 12 insertions, 11 deletions
diff --git a/test/sequential/test-child-process-execsync.js b/test/sequential/test-child-process-execsync.js
index 710137e419..fd9970db7d 100644
--- a/test/sequential/test-child-process-execsync.js
+++ b/test/sequential/test-child-process-execsync.js
@@ -5,12 +5,12 @@ const assert = require('assert');
const execSync = require('child_process').execSync;
const execFileSync = require('child_process').execFileSync;
-var TIMER = 200;
-var SLEEP = 2000;
+const TIMER = 200;
+const SLEEP = 2000;
-var start = Date.now();
-var err;
-var caught = false;
+const start = Date.now();
+let err;
+let caught = false;
// Verify that stderr is not accessed when a bad shell is used
assert.throws(
@@ -24,9 +24,10 @@ assert.throws(
'execFileSync did not throw the expected exception!'
);
+let cmd, ret;
try {
- var cmd = `"${process.execPath}" -e "setTimeout(function(){}, ${SLEEP});"`;
- var ret = execSync(cmd, {timeout: TIMER});
+ cmd = `"${process.execPath}" -e "setTimeout(function(){}, ${SLEEP});"`;
+ ret = execSync(cmd, {timeout: TIMER});
} catch (e) {
caught = true;
assert.strictEqual(e.errno, 'ETIMEDOUT');
@@ -34,7 +35,7 @@ try {
} finally {
assert.strictEqual(ret, undefined, 'we should not have a return value');
assert.strictEqual(caught, true, 'execSync should throw');
- var end = Date.now() - start;
+ const end = Date.now() - start;
assert(end < SLEEP);
assert(err.status > 128 || err.signal);
}
@@ -43,8 +44,8 @@ assert.throws(function() {
execSync('iamabadcommand');
}, /Command failed: iamabadcommand/);
-var msg = 'foobar';
-var msgBuf = Buffer.from(msg + '\n');
+const msg = 'foobar';
+const msgBuf = Buffer.from(msg + '\n');
// console.log ends every line with just '\n', even on Windows.
@@ -59,7 +60,7 @@ ret = execSync(cmd, { encoding: 'utf8' });
assert.strictEqual(ret, msg + '\n', 'execSync encoding result should match');
-var args = [
+const args = [
'-e',
`console.log("${msg}");`
];