summaryrefslogtreecommitdiff
path: root/test/parallel/test-blob-buffer-too-large.js
blob: 2fd8b8754bd593a0da069044d33fcd6bba82f9c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Flags: --no-warnings
'use strict';

const common = require('../common');
const assert = require('assert');
const { Blob } = require('buffer');

if (common.isFreeBSD)
  common.skip('Oversized buffer make the FreeBSD CI runner crash');

try {
  new Blob([new Uint8Array(0xffffffff), [1]]);
} catch (e) {
  if (
    e.message === 'Array buffer allocation failed' ||
    e.message === 'Invalid typed array length: 4294967295'
  ) {
    common.skip(
      'Insufficient memory on this platform for oversized buffer test.'
    );
  } else {
    assert.strictEqual(e.code, 'ERR_BUFFER_TOO_LARGE');
  }
}