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

Function testFileReadable

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

Source from the content-addressed store, hash-verified

85};
86
87const testFileReadable = async (t, fdNumber, execaMethod) => {
88 const {stream, filePath} = await createFileReadStream();
89
90 const fdNumberString = fdNumber === 'input' ? '0' : `${fdNumber}`;
91 const {stdout} = await execaMethod('stdin-fd.js', [fdNumberString], getStdio(fdNumber, stream));
92 t.is(stdout, 'foobar');
93
94 await rm(filePath);
95};
96
97test('input can be a Node.js Readable with a file descriptor', testFileReadable, 'input', execa);
98test('stdin can be a Node.js Readable with a file descriptor', testFileReadable, 0, execa);

Callers

nothing calls this directly

Calls 2

getStdioFunction · 0.90
createFileReadStreamFunction · 0.85

Tested by

no test coverage detected