Permalink
Browse files

test: use common module API in test-child-process-exec-stdout-stderr-…

…data-string

PR-URL: #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>
  • Loading branch information...
sreepurnajasti authored and maclover7 committed Dec 19, 2017
1 parent 1dd9c82 commit 4d74b52979c60391bc369be69a34463eba61f383
Showing with 4 additions and 14 deletions.
  1. +4 −14 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');
}));

0 comments on commit 4d74b52

Please sign in to comment.