1// Flags: --expose-internals 2'use strict'; 3const common = require('../common'); 4const { recordState } = require('../common/heap'); 5const { Worker } = require('worker_threads'); 6const { once } = require('events'); 7 8(async function() { 9 const w = new Worker('setInterval(() => {}, 100)', { eval: true }); 10 11 await once(w, 'online'); 12 const stream = await w.getHeapSnapshot(); 13 const snapshot = recordState(stream); 14 snapshot.validateSnapshot('Node / MessagePort', [ 15 { 16 children: [ 17 { node_name: 'Node / MessagePortData', edge_name: 'data' }, 18 ] 19 }, 20 ], { loose: true }); 21 await w.terminate(); 22})().then(common.mustCall()); 23