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

Function testFileWritableOpen

test/stdio/node-stream-native.js:164–175  ·  view source on GitHub ↗
(t, fdNumber, useSingle, execaMethod)

Source from the content-addressed store, hash-verified

162test.serial('stdio[*] handles errors from a Node.js Writable with a file descriptor', testFileWritableError, 3);
163
164const testFileWritableOpen = async (t, fdNumber, useSingle, execaMethod) => {
165 const {stream, filePath} = await createFileWriteStream();
166 t.deepEqual(stream.eventNames(), []);
167
168 const stdioOption = useSingle ? stream : [stream, 'pipe'];
169 await execaMethod('empty.js', getStdio(fdNumber, stdioOption));
170
171 t.is(stream.writable, useSingle);
172 t.deepEqual(stream.eventNames(), []);
173
174 await rm(filePath);
175};
176
177test('stdout leaves open a single Node.js Writable with a file descriptor', testFileWritableOpen, 1, true, execa);
178test('stdout closes a combined Node.js Writable with a file descriptor', testFileWritableOpen, 1, false, execa);

Callers

nothing calls this directly

Calls 2

getStdioFunction · 0.90
createFileWriteStreamFunction · 0.85

Tested by

no test coverage detected