From 32be129762191464b44c85213f49b501e147fea3 Mon Sep 17 00:00:00 2001 From: ehmicky Date: Sun, 28 Apr 2024 19:30:43 +0100 Subject: [PATCH] Run CI on Node 22 --- .github/workflows/main.yml | 3 +-- package.json | 2 +- test/array-buffer.js | 15 ++------------- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a768beb..9c27cac 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,8 +10,7 @@ jobs: fail-fast: false matrix: node-version: - - 21 - - 20 + - 22 - 18 steps: - uses: actions/checkout@v4 diff --git a/package.json b/package.json index ab1554c..17f5325 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/test/array-buffer.js b/test/array-buffer.js index 4afe633..f544cd4 100644 --- a/test/array-buffer.js +++ b/test/array-buffer.js @@ -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, @@ -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])),