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

Function testGeneratorReturn

test/transform/validate.js:18–22  ·  view source on GitHub ↗
(t, fdNumber, generator, input, objectMode, isInput)

Source from the content-addressed store, hash-verified

16
17// eslint-disable-next-line max-params
18const testGeneratorReturn = async (t, fdNumber, generator, input, objectMode, isInput) => {
19 const fixtureName = isInput ? 'stdin-fd.js' : 'noop-fd.js';
20 const {message} = await t.throwsAsync(execa(fixtureName, [`${fdNumber}`], getStdio(fdNumber, generator(input)(objectMode))));
21 t.true(message.includes(getMessage(input)));
22};
23
24test('Generators with result.stdin cannot return an object if not in objectMode', testGeneratorReturn, 0, inputGenerator, foobarObject, false, true);
25test('Generators with result.stdio[*] as input cannot return an object if not in objectMode', testGeneratorReturn, 3, inputGenerator, foobarObject, false, true);

Callers

nothing calls this directly

Calls 3

getStdioFunction · 0.90
generatorFunction · 0.85
getMessageFunction · 0.70

Tested by

no test coverage detected