Skip to content

Commit 5314754

Browse files
sreepurnajastiMylesBorins
authored andcommitted
test: use common module API in test-child-process-exec-stdout-stderr-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]>
1 parent 6816414 commit 5314754

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

test/parallel/test-child-process-exec-stdout-stderr-data-string.js

+4-14
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,10 @@ const common = require('../common');
44
const assert = require('assert');
55
const exec = require('child_process').exec;
66

7-
let stdoutCalls = 0;
8-
let stderrCalls = 0;
9-
107
const command = common.isWindows ? 'dir' : 'ls';
11-
exec(command).stdout.on('data', (data) => {
12-
stdoutCalls += 1;
13-
});
148

15-
exec('fhqwhgads').stderr.on('data', (data) => {
16-
assert.strictEqual(typeof data, 'string');
17-
stderrCalls += 1;
18-
});
9+
exec(command).stdout.on('data', common.mustCallAtLeast());
1910

20-
process.on('exit', () => {
21-
assert(stdoutCalls > 0);
22-
assert(stderrCalls > 0);
23-
});
11+
exec('fhqwhgads').stderr.on('data', common.mustCallAtLeast((data) => {
12+
assert.strictEqual(typeof data, 'string');
13+
}));

0 commit comments

Comments
 (0)