1// Flags: --no-warnings
2'use strict';
3
4const common = require('../common');
5const assert = require('assert');
6const { Blob } = require('buffer');
7
8if (common.isFreeBSD)
9  common.skip('Oversized buffer make the FreeBSD CI runner crash');
10
11try {
12  new Blob([new Uint8Array(0xffffffff), [1]]);
13} catch (e) {
14  if (
15    e.message === 'Array buffer allocation failed' ||
16    e.message === 'Invalid typed array length: 4294967295'
17  ) {
18    common.skip(
19      'Insufficient memory on this platform for oversized buffer test.'
20    );
21  } else {
22    assert.strictEqual(e.code, 'ERR_BUFFER_TOO_LARGE');
23  }
24}
25