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

Function assertErrorMessage

test/helpers/max-buffer.js:5–10  ·  view source on GitHub ↗
(t, shortMessage, {execaMethod = execa, length = maxBuffer, fdNumber = 1, unit = 'characters'} = {})

Source from the content-addressed store, hash-verified

3export const maxBuffer = 10;
4
5export const assertErrorMessage = (t, shortMessage, {execaMethod = execa, length = maxBuffer, fdNumber = 1, unit = 'characters'} = {}) => {
6 const [expectedStreamName, expectedUnit] = execaMethod === execaSync
7 ? ['output', 'bytes']
8 : [STREAM_NAMES[fdNumber], unit];
9 t.true(shortMessage.includes(`${expectedStreamName} was larger than ${length} ${expectedUnit}`));
10};
11
12const STREAM_NAMES = ['stdin', 'stdout', 'stderr', 'stdio[3]'];

Callers 15

testAboveMaxBufferFunction · 0.90
testMaxBufferUnitFunction · 0.90
testMaxBufferUnitSyncFunction · 0.90
testGracefulExitFunction · 0.90
testGracefulExitSyncFunction · 0.90
testMaxBufferLimitFunction · 0.90
testMaxBufferDefaultFunction · 0.90
testFdSpecificFunction · 0.90
max-buffer.jsFile · 0.90
testAllFunction · 0.90
testMaxBufferEncodingFunction · 0.90
testMaxBufferHexFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected