MCPcopy Create free account
hub / github.com/sindresorhus/execa / assertPause

Function assertPause

test/convert/readable.js:390–408  ·  view source on GitHub ↗
(t, stream, subprocess)

Source from the content-addressed store, hash-verified

388});
389
390const 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
410test('.readable() can be paused', async t => {
411 const subprocess = getReadableSubprocess();

Callers 1

readable.jsFile · 0.85

Calls 2

finishedStreamFunction · 0.90
assertSubprocessOutputFunction · 0.90

Tested by

no test coverage detected