mirror of
https://github.com/nodejs/node.git
synced 2024-11-27 22:16:50 +01:00
873e5ce54a
PR-URL: https://github.com/nodejs/node/pull/46610 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
23 lines
652 B
JavaScript
23 lines
652 B
JavaScript
// Flags: --expose-internals
|
|
'use strict';
|
|
const common = require('../common');
|
|
const { recordState } = require('../common/heap');
|
|
const { Worker } = require('worker_threads');
|
|
const { once } = require('events');
|
|
|
|
(async function() {
|
|
const w = new Worker('setInterval(() => {}, 100)', { eval: true });
|
|
|
|
await once(w, 'online');
|
|
const stream = await w.getHeapSnapshot();
|
|
const snapshot = recordState(stream);
|
|
snapshot.validateSnapshot('Node / MessagePort', [
|
|
{
|
|
children: [
|
|
{ node_name: 'Node / MessagePortData', edge_name: 'data' },
|
|
],
|
|
},
|
|
], { loose: true });
|
|
await w.terminate();
|
|
})().then(common.mustCall());
|