(opts, command, wantsError, test)
| 142 | } |
| 143 | |
| 144 | function workerTest(opts, command, wantsError, test) { |
| 145 | let workerError = null; |
| 146 | const worker = new Worker(command, { |
| 147 | ...opts, |
| 148 | execArgv: [], |
| 149 | eval: true, |
| 150 | stdout: true, |
| 151 | stderr: true |
| 152 | }); |
| 153 | worker.on('error', (err) => { |
| 154 | workerError = err; |
| 155 | }); |
| 156 | worker.on('exit', common.mustCall((code) => { |
| 157 | assert.strictEqual(code, wantsError ? 1 : 0); |
| 158 | collectStream(worker.stdout).then((stdout) => { |
| 159 | test(workerError, stdout); |
| 160 | }).then(common.mustCall()); |
| 161 | })); |
| 162 | } |
no test coverage detected