mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
b872d30d19
Support configuration of the HeapSnapshotMode and NumericsMode fields inf HeapSnapshotOptions in the JS APIs for heap snapshots. PR-URL: https://github.com/nodejs/node/pull/44989 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
22 lines
621 B
JavaScript
22 lines
621 B
JavaScript
// Flags: --expose-internals
|
|
'use strict';
|
|
const common = require('../common');
|
|
const { recordState, getHeapSnapshotOptionTests } = require('../common/heap');
|
|
const { Worker } = require('worker_threads');
|
|
const { once } = require('events');
|
|
|
|
(async function() {
|
|
const tests = getHeapSnapshotOptionTests();
|
|
const w = new Worker(tests.fixtures);
|
|
|
|
await once(w, 'message');
|
|
|
|
for (const { options, expected } of tests.cases) {
|
|
const stream = await w.getHeapSnapshot(options);
|
|
const snapshot = recordState(stream);
|
|
tests.check(snapshot, expected);
|
|
}
|
|
|
|
await w.terminate();
|
|
})().then(common.mustCall());
|