2020-01-29 16:41:26 +00:00
|
|
|
// 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: [
|
2021-03-26 15:51:08 +00:00
|
|
|
{ node_name: 'Node / MessagePortData', edge_name: 'data' },
|
2023-02-12 16:36:39 +00:00
|
|
|
],
|
2021-03-26 15:51:08 +00:00
|
|
|
},
|
2020-01-29 16:41:26 +00:00
|
|
|
], { loose: true });
|
|
|
|
await w.terminate();
|
|
|
|
})().then(common.mustCall());
|