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
Add `error.isMaxBuffer` (#963)ehmickybefore adoption9e6e19e
lines 1–12why, one step back1import {execa, execaSync} from '../../index.js';23export const maxBuffer = 10;45export const assertErrorMessage = (t, shortMessage, {execaMethod = execa, length = maxBuffer, fdNumber = 1, unit = 'characters'} = {}) => {6 const [expectedStreamName, expectedUnit] = execaMethod === execaSync7 ? ['output', 'bytes']8 : [STREAM_NAMES[fdNumber], unit];9 t.true(shortMessage.includes(`${expectedStreamName} was larger than ${length} ${expectedUnit}`));10};1112const STREAM_NAMES = ['stdin', 'stdout', 'stderr', 'stdio[3]'];