Skip to content
Myr

Fix `error.stdout|stderr|all` type when `encoding` option is used (#652)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by ehmicky · committed by GitHub · parent 7701e9e · Browse files · 2 files+37 added−21 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+37 added−21 removed

  • tests:+15 added−0 removed
  • other:+22 added−21 removed

2 files+37 added−21 removed

modified:lib/stream.js+22 added-21 removed
modified:test/stream.js+15 added
100 unmodified lines
101102test('maxBuffer affects stdout', testMaxBuffer, 'stdout');103test('maxBuffer affects stderr', testMaxBuffer, 'stderr');104105test('maxBuffer works with encoding buffer', async t => {106 const {stdout} = await t.throwsAsync(107 execa('max-buffer.js', ['stdout', '11'], {maxBuffer: 10, encoding: 'buffer'}),108 );109 t.true(stdout instanceof Uint8Array);110 t.is(Buffer.from(stdout).toString(), '.'.repeat(10));111});112113test('maxBuffer works with other encodings', async t => {114 const {stdout} = await t.throwsAsync(115 execa('max-buffer.js', ['stdout', '11'], {maxBuffer: 10, encoding: 'hex'}),116 );117 t.is(stdout, Buffer.from('.'.repeat(10)).toString('hex'));118});119120const testNoMaxBuffer = async (t, streamName) => {121 const promise = execa('max-buffer.js', [streamName, '10'], {buffer: false});122 const [result, output] = await Promise.all([123 promise,
102 unmodified lines