(t, stream, subprocess)
| 388 | }); |
| 389 | |
| 390 | const assertPause = async (t, stream, subprocess) => { |
| 391 | const onceData = once(stream, 'data'); |
| 392 | stream.pause(); |
| 393 | |
| 394 | t.is(stream.readableLength, 0); |
| 395 | do { |
| 396 | // eslint-disable-next-line no-await-in-loop |
| 397 | await setTimeout(10); |
| 398 | } while (stream.readableLength === 0); |
| 399 | |
| 400 | t.false(await Promise.race([onceData, false])); |
| 401 | |
| 402 | stream.resume(); |
| 403 | const [output] = await onceData; |
| 404 | t.is(output.toString(), foobarString); |
| 405 | |
| 406 | await finishedStream(stream); |
| 407 | await assertSubprocessOutput(t, subprocess); |
| 408 | }; |
| 409 | |
| 410 | test('.readable() can be paused', async t => { |
| 411 | const subprocess = getReadableSubprocess(); |
no test coverage detected