1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-20 22:34:46 -05:00
denoland-deno/tests/node_compat/test/parallel/test-blob-buffer-too-large.js

32 lines
884 B
JavaScript
Raw Normal View History

// deno-fmt-ignore-file
// deno-lint-ignore-file
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node 20.11.1
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
// Flags: --no-warnings
'use strict';
const common = require('../common');
const assert = require('assert');
const { Blob, kMaxLength } = require('buffer');
if (common.isFreeBSD)
common.skip('Oversized buffer make the FreeBSD CI runner crash');
try {
new Blob([new Uint8Array(kMaxLength), [1]]);
} catch (e) {
if (
e.message === 'Array buffer allocation failed' ||
e.message === `Invalid typed array length: ${kMaxLength}`
) {
common.skip(
'Insufficient memory on this platform for oversized buffer test.'
);
} else {
assert.strictEqual(e.code, 'ERR_BUFFER_TOO_LARGE');
}
}