summaryrefslogtreecommitdiff
path: root/test/node-api/test_buffer/test-external-buffer.js
blob: 4f220f1d21e9ce12eed1fd432629ca31c7a569d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
'use strict';

const common = require('../../common');
const binding = require(`./build/${common.buildType}/test_buffer`);
const assert = require('assert');

// Regression test for https://github.com/nodejs/node/issues/31134
// Buffers with finalizers are allowed to remain alive until
// Environment cleanup without crashing the process.
// The test stores the buffer on `process` to make sure it lives as long as
// the Context does.

process.externalBuffer = binding.newExternalBuffer();
assert.strictEqual(process.externalBuffer.toString(), binding.theText);