MCPcopy
hub / github.com/sindresorhus/execa / testEarlySuccess

Function testEarlySuccess

test/convert/writable.js:92–102  ·  view source on GitHub ↗
(t, methodName, hasWrites)

Source from the content-addressed store, hash-verified

90});
91
92const testEarlySuccess = async (t, methodName, hasWrites) => {
93 const subprocess = hasWrites ? getReadableSubprocess() : execa('empty.js');
94 const stream = subprocess[methodName]();
95
96 const error = await t.throwsAsync(finishedStream(stream));
97 t.like(error, prematureClose);
98 assertWritableAborted(t, subprocess.stdin);
99 t.true(subprocess.stdout.readableEnded);
100 t.true(subprocess.stderr.readableEnded);
101 await assertSubprocessOutput(t, subprocess, hasWrites ? foobarString : '');
102};
103
104test('subprocess early success with no writes -> .writable() abort', testEarlySuccess, 'writable', false);
105test('subprocess early success with no writes -> .duplex() abort', testEarlySuccess, 'duplex', false);

Callers

nothing calls this directly

Calls 4

getReadableSubprocessFunction · 0.90
finishedStreamFunction · 0.90
assertWritableAbortedFunction · 0.90
assertSubprocessOutputFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…