xref: /third_party/node/test/parallel/test-blob-buffer-too-large.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci// Flags: --no-warnings
21cb0ef41Sopenharmony_ci'use strict';
31cb0ef41Sopenharmony_ci
41cb0ef41Sopenharmony_ciconst common = require('../common');
51cb0ef41Sopenharmony_ciconst assert = require('assert');
61cb0ef41Sopenharmony_ciconst { Blob } = require('buffer');
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ciif (common.isFreeBSD)
91cb0ef41Sopenharmony_ci  common.skip('Oversized buffer make the FreeBSD CI runner crash');
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_citry {
121cb0ef41Sopenharmony_ci  new Blob([new Uint8Array(0xffffffff), [1]]);
131cb0ef41Sopenharmony_ci} catch (e) {
141cb0ef41Sopenharmony_ci  if (
151cb0ef41Sopenharmony_ci    e.message === 'Array buffer allocation failed' ||
161cb0ef41Sopenharmony_ci    e.message === 'Invalid typed array length: 4294967295'
171cb0ef41Sopenharmony_ci  ) {
181cb0ef41Sopenharmony_ci    common.skip(
191cb0ef41Sopenharmony_ci      'Insufficient memory on this platform for oversized buffer test.'
201cb0ef41Sopenharmony_ci    );
211cb0ef41Sopenharmony_ci  } else {
221cb0ef41Sopenharmony_ci    assert.strictEqual(e.code, 'ERR_BUFFER_TOO_LARGE');
231cb0ef41Sopenharmony_ci  }
241cb0ef41Sopenharmony_ci}
25

Indexes created Thu Nov 07 10:32:03 CST 2024