Skip to content

Commit

Permalink
Run CI on Node 22
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Apr 28, 2024
1 parent 83a78c0 commit 32be129
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
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;

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

0 comments on commit 32be129

Please sign in to comment.