Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run CI on Node 22 #129

Merged
merged 1 commit into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ jobs:
fail-fast: false
matrix:
node-version:
- 21
- 20
- 22
- 18
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"onetime": "^7.0.0",
"precise-now": "^3.0.0",
"stream-json": "^1.8.0",
"tsd": "^0.29.0",
"tsd": "^0.31.0",
"xo": "^0.58.0"
}
}
15 changes: 2 additions & 13 deletions test/array-buffer.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {Buffer, constants as BufferConstants} from 'node:buffer';
import {Buffer} from 'node:buffer';
import {arrayBuffer, blob} from 'node:stream/consumers';
import test from 'ava';
import {getStreamAsArrayBuffer, MaxBufferError} from '../source/index.js';
import {createStream, BIG_TEST_DURATION} from './helpers/index.js';
import {createStream} from './helpers/index.js';
import {
fixtureString,
fixtureLength,
Expand Down Expand Up @@ -100,17 +100,6 @@ test(
new Uint8Array(Buffer.from(`${fixtureString}${fixtureString[0]}`)).buffer,
);

test('handles streams larger than arrayBuffer max length', async t => {
t.timeout(BIG_TEST_DURATION);
const chunkCount = Math.floor(BufferConstants.MAX_LENGTH / CHUNK_SIZE * 2);
const chunk = Buffer.alloc(CHUNK_SIZE);
const maxBufferChunks = Array.from({length: chunkCount}, () => chunk);
const {bufferedData} = await t.throwsAsync(setupArrayBuffer(maxBufferChunks));
t.is(new Uint8Array(bufferedData)[0], 0);
});

const CHUNK_SIZE = 2 ** 16;
Copy link
Collaborator Author

@ehmicky ehmicky May 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Node 22 increased the maximum size of Buffer and ArrayBuffer from 4GB to 75GB. This is too high to be able to run this test without either crashing the process or making the test run for too long.

Thankfully, we run a similar test but for the other methods getStream(), etc. so they should be covering that case.


test('getStreamAsArrayBuffer() behaves like arrayBuffer()', async t => {
const [nativeResult, customResult] = await Promise.all([
arrayBuffer(createStream([bigArrayBuffer])),
Expand Down