max-buffer.js
This file
Path
test/helpers/max-buffer.js
12 lines · 517 bytes · JavaScript
Last changed by
Add `error.isMaxBuffer` (#963)ehmickybefore adoption9e6e19e
History of this fileTake it
12345678910111213import {execa, execaSync} from '../../index.js';
export const maxBuffer = 10;
export const assertErrorMessage = (t, shortMessage, {execaMethod = execa, length = maxBuffer, fdNumber = 1, unit = 'characters'} = {}) => { const [expectedStreamName, expectedUnit] = execaMethod === execaSync ? ['output', 'bytes'] : [STREAM_NAMES[fdNumber], unit]; t.true(shortMessage.includes(`${expectedStreamName} was larger than ${length} ${expectedUnit}`));};
const STREAM_NAMES = ['stdin', 'stdout', 'stderr', 'stdio[3]'];