Skip to content

Commit

Permalink
test: use common module API in test-child-process-exec-stdout-stderr-…
Browse files Browse the repository at this point in the history
…data-string

PR-URL: #17751
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Jon Moss <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
  • Loading branch information
sreepurnajasti authored and MylesBorins committed Jan 9, 2018
1 parent 2d61b9e commit ded097a
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions test/parallel/test-child-process-exec-stdout-stderr-data-string.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ded097a

Please sign in to comment.