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 472d31f16ac920..1fbdfbf8e45b4d 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'); +}));