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

Function testFileReadableOpen

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

Source from the content-addressed store, hash-verified

114test.serial('stdio[*] handles errors from a Node.js Readable with a file descriptor', testFileReadableError, 3);
115
116const testFileReadableOpen = async (t, fdNumber, useSingle, execaMethod) => {
117 const {stream, filePath} = await createFileReadStream();
118 t.deepEqual(stream.eventNames(), []);
119
120 const stdioOption = useSingle ? stream : [stream, 'pipe'];
121 await execaMethod('empty.js', getStdio(fdNumber, stdioOption));
122
123 t.is(stream.readable, useSingle && fdNumber !== 'input');
124 t.deepEqual(stream.eventNames(), []);
125
126 await rm(filePath);
127};
128
129test('input closes a Node.js Readable with a file descriptor', testFileReadableOpen, 'input', true, execa);
130test('stdin leaves open a single Node.js Readable with a file descriptor', testFileReadableOpen, 0, true, execa);

Callers

nothing calls this directly

Calls 2

getStdioFunction · 0.90
createFileReadStreamFunction · 0.85

Tested by

no test coverage detected