Upgrade `get-stream` (#908)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by ehmicky · committed by GitHub · parent 8ee5985 · Browse files · 4 files·+13 added−13 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+13 added−13 removed
- tests:+12 added−12 removed
- other:+1 added−1 removed
Provenance
- Commit
3ecd447- Tree
4d47373- Author
ehmicky <ehmicky@users.noreply.github.com>- Committer
GitHub <noreply@github.com>- Parent
8ee5985
4 files changed+13 added−13 removed
modified:test/stdio/transform.js+5 added-4 removed
103 unmodified lines104 }105 };106 107 const testManyYields = async (t, final) => {108- const subprocess = execa('noop.js', {stdout: convertTransformToFinal(manyYieldGenerator, final), buffer: false});109- const [chunks] = await Promise.all([getStreamAsArray(subprocess.stdout), subprocess]);110- const expectedChunk = Buffer.alloc(defaultHighWaterMark * chunksPerCall).fill('\n');111- t.deepEqual(chunks, Array.from({length: callCount}).fill(expectedChunk));108+ const subprocess = execa('noop.js', {stdout: convertTransformToFinal(manyYieldGenerator, final), stripFinalNewline: false});109+ const [chunks, {stdout}] = await Promise.all([getStreamAsArray(subprocess.stdout), subprocess]);110+ const expectedChunk = Buffer.from(fullString);111+ t.deepEqual(chunks, Array.from({length: callCount * partsPerChunk * chunksPerCall}).fill(expectedChunk));112+ t.is(chunks.join(''), stdout);113 };114 115 test('Generator "transform" yields are sent right away', testManyYields, false);116 test('Generator "final" yields are sent right away', testManyYields, true);89 unmodified linesmodified:test/stream/max-buffer.js+1 added-1 removed
97 unmodified lines98991001011021021031041051062 unmodified lines97 unmodified linesconst testMaxBufferAbort = async (t, fdNumber) => { const subprocess = execa('max-buffer.js', [`${fdNumber}`, `${maxBuffer + 1}`], {...fullStdio, maxBuffer}); await Promise.all([ t.throwsAsync(subprocess, {message: /maxBuffer exceeded/}), t.throwsAsync(getStream(subprocess.stdio[fdNumber]), {code: 'ABORT_ERR'}), t.throwsAsync(getStream(subprocess.stdio[fdNumber]), {code: 'ERR_STREAM_PREMATURE_CLOSE'}), ]);};
test('abort stream when hitting maxBuffer with stdout', testMaxBufferAbort, 1);2 unmodified linesmodified:test/stream/no-buffer.js+6 added-7 removed
43 unmodified lines44 all ? getOutput(subprocess.all) : undefined,45 ]);46 47 const expectedResult = buffer ? foobarString : undefined;48- const expectedOutput = !buffer || useDataEvents ? foobarString : '';48 49 t.is(result.stdio[fdNumber], expectedResult);51- t.is(output, expectedOutput);50+ t.is(output, foobarString);51 52 if (all) {53 t.is(result.all, expectedResult);55- t.is(allOutput, expectedOutput);54+ t.is(allOutput, foobarString);55 }56 };57 58 test('Can iterate stdout when `buffer` set to `false`', testIterationBuffer, 1, false, false, false);59 test('Can iterate stderr when `buffer` set to `false`', testIterationBuffer, 2, false, false, false);60 test('Can iterate stdio[*] when `buffer` set to `false`', testIterationBuffer, 3, false, false, false);61 test('Can iterate all when `buffer` set to `false`', testIterationBuffer, 1, false, false, true);63-test('Cannot iterate stdout when `buffer` set to `true`', testIterationBuffer, 1, true, false, false);64-test('Cannot iterate stderr when `buffer` set to `true`', testIterationBuffer, 2, true, false, false);65-test('Cannot iterate stdio[*] when `buffer` set to `true`', testIterationBuffer, 3, true, false, false);66-test('Cannot iterate all when `buffer` set to `true`', testIterationBuffer, 1, true, false, true);62+test('Can iterate stdout when `buffer` set to `true`', testIterationBuffer, 1, true, false, false);63+test('Can iterate stderr when `buffer` set to `true`', testIterationBuffer, 2, true, false, false);64+test('Can iterate stdio[*] when `buffer` set to `true`', testIterationBuffer, 3, true, false, false);65+test('Can iterate all when `buffer` set to `true`', testIterationBuffer, 1, true, false, true);66 test('Can listen to `data` events on stdout when `buffer` set to `false`', testIterationBuffer, 1, false, true, false);67 test('Can listen to `data` events on stderr when `buffer` set to `false`', testIterationBuffer, 2, false, true, false);68 test('Can listen to `data` events on stdio[*] when `buffer` set to `false`', testIterationBuffer, 3, false, true, false);69 test('Can listen to `data` events on all when `buffer` set to `false`', testIterationBuffer, 1, false, true, true);41 unmodified linesmodified:package.json+1 added-1 removed
48 unmodified lines49 "dependencies": {50 "@sindresorhus/merge-streams": "^3.0.0",51 "cross-spawn": "^7.0.3",52 "figures": "^6.1.0",53- "get-stream": "^8.0.1",53+ "get-stream": "^9.0.0",54 "human-signals": "^6.0.0",55 "is-plain-obj": "^4.1.0",56 "is-stream": "^4.0.1",57 "npm-run-path": "^5.2.0",41 unmodified lines