diff options
author | Emanuel Buholzer <EmanuelBuholzer@outlook.com> | 2016-12-18 03:04:37 +0100 |
---|---|---|
committer | Italo A. Casas <me@italoacasas.com> | 2016-12-22 20:25:22 -0500 |
commit | bc57f241faebdaebe56e406a4da231557a4d01d4 (patch) | |
tree | 5231b43bd00e219712294e0a0ff2ba85fd563e2d /test/parallel/test-stdin-script-child.js | |
parent | f368eee19f3094510f3c410f0e01aa1cd2a5e82e (diff) | |
download | android-node-v8-bc57f241faebdaebe56e406a4da231557a4d01d4.tar.gz android-node-v8-bc57f241faebdaebe56e406a4da231557a4d01d4.tar.bz2 android-node-v8-bc57f241faebdaebe56e406a4da231557a4d01d4.zip |
test: refactor test-stdin-script-child
- var -> const where possible
- assert.equal -> assert.strictEqual
- passed the setTimeout function a second parameter for readability
- used assert.strictEqual for assert(!c) as it is expected to be 0 and
not some other value
PR-URL: https://github.com/nodejs/node/pull/10321
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
Diffstat (limited to 'test/parallel/test-stdin-script-child.js')
-rw-r--r-- | test/parallel/test-stdin-script-child.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/test/parallel/test-stdin-script-child.js b/test/parallel/test-stdin-script-child.js index ad65734364..091c5cb29a 100644 --- a/test/parallel/test-stdin-script-child.js +++ b/test/parallel/test-stdin-script-child.js @@ -1,14 +1,14 @@ 'use strict'; -require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); -var spawn = require('child_process').spawn; -var child = spawn(process.execPath, [], { +const spawn = require('child_process').spawn; +const child = spawn(process.execPath, [], { env: Object.assign(process.env, { NODE_DEBUG: process.argv[2] }) }); -var wanted = child.pid + '\n'; +const wanted = child.pid + '\n'; var found = ''; child.stdout.setEncoding('utf8'); @@ -21,12 +21,12 @@ child.stderr.on('data', function(c) { console.error('> ' + c.trim().split(/\n/).join('\n> ')); }); -child.on('close', function(c) { - assert(!c); - assert.equal(found, wanted); +child.on('close', common.mustCall(function(c) { + assert.strictEqual(c, 0); + assert.strictEqual(found, wanted); console.log('ok'); -}); +})); setTimeout(function() { child.stdin.end('console.log(process.pid)'); -}); +}, 1); |