Skip to content

Commit 9b7d2c2

Browse files
targosdanielleadams
authored andcommitted
test: guard large string decoder allocation
Use common.enoughTestMem to avoid "Array buffer allocation failed" error on low memory devices. Fixes: #36792 PR-URL: #36795 Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Pooja D P <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
1 parent bff201a commit 9b7d2c2

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

test/parallel/test-string-decoder.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,14 @@ assert.throws(
201201
}
202202
);
203203

204-
assert.throws(
205-
() => new StringDecoder().write(Buffer.alloc(0x1fffffe8 + 1).fill('a')),
206-
{
207-
code: 'ERR_STRING_TOO_LONG',
208-
}
209-
);
204+
if (common.enoughTestMem) {
205+
assert.throws(
206+
() => new StringDecoder().write(Buffer.alloc(0x1fffffe8 + 1).fill('a')),
207+
{
208+
code: 'ERR_STRING_TOO_LONG',
209+
}
210+
);
211+
}
210212

211213
// Test verifies that StringDecoder will correctly decode the given input
212214
// buffer with the given encoding to the expected output. It will attempt all

0 commit comments

Comments
 (0)