diff options
author | sreepurnajasti <sreepurna.jasti@gmail.com> | 2017-12-19 11:44:04 +0530 |
---|---|---|
committer | Jon Moss <me@jonathanmoss.me> | 2017-12-23 22:58:17 -0500 |
commit | 4d74b52979c60391bc369be69a34463eba61f383 (patch) | |
tree | 21e89b6c4b1762bc3e2476c3ebae648e6d6e9c86 /test | |
parent | 1dd9c826e0f6b9d6b4df84486165e5d3aefbc348 (diff) | |
download | android-node-v8-4d74b52979c60391bc369be69a34463eba61f383.tar.gz android-node-v8-4d74b52979c60391bc369be69a34463eba61f383.tar.bz2 android-node-v8-4d74b52979c60391bc369be69a34463eba61f383.zip |
test: use common module API in test-child-process-exec-stdout-stderr-data-string
PR-URL: https://github.com/nodejs/node/pull/17751
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-child-process-exec-stdout-stderr-data-string.js | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/test/parallel/test-child-process-exec-stdout-stderr-data-string.js b/test/parallel/test-child-process-exec-stdout-stderr-data-string.js index 472d31f16a..1fbdfbf8e4 100644 --- a/test/parallel/test-child-process-exec-stdout-stderr-data-string.js +++ b/test/parallel/test-child-process-exec-stdout-stderr-data-string.js @@ -4,20 +4,10 @@ const common = require('../common'); const assert = require('assert'); const exec = require('child_process').exec; -let stdoutCalls = 0; -let stderrCalls = 0; - const command = common.isWindows ? 'dir' : 'ls'; -exec(command).stdout.on('data', (data) => { - stdoutCalls += 1; -}); -exec('fhqwhgads').stderr.on('data', (data) => { - assert.strictEqual(typeof data, 'string'); - stderrCalls += 1; -}); +exec(command).stdout.on('data', common.mustCallAtLeast()); -process.on('exit', () => { - assert(stdoutCalls > 0); - assert(stderrCalls > 0); -}); +exec('fhqwhgads').stderr.on('data', common.mustCallAtLeast((data) => { + assert.strictEqual(typeof data, 'string'); +})); |