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

Function testGeneratorReturnSync

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

Source from the content-addressed store, hash-verified

39
40// eslint-disable-next-line max-params
41const testGeneratorReturnSync = (t, fdNumber, generator, input, objectMode, isInput) => {
42 const fixtureName = isInput ? 'stdin-fd.js' : 'noop-fd.js';
43 const {message} = t.throws(() => {
44 execaSync(fixtureName, [`${fdNumber}`], getStdio(fdNumber, generator(input)(objectMode)));
45 });
46 t.true(message.includes(getMessage(input)));
47};
48
49test('Generators with result.stdin cannot return an object if not in objectMode, sync', testGeneratorReturnSync, 0, inputGenerator, foobarObject, false, true);
50test('The last generator with result.stdin cannot return an object even in objectMode, sync', testGeneratorReturnSync, 0, lastInputGenerator, foobarObject, true, true);

Callers

nothing calls this directly

Calls 3

getStdioFunction · 0.90
generatorFunction · 0.85
getMessageFunction · 0.70

Tested by

no test coverage detected