11cb0ef41Sopenharmony_ci// Flags: --expose-internals 21cb0ef41Sopenharmony_ci'use strict'; 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciconst { recordState } = require('../common/heap'); 51cb0ef41Sopenharmony_ciconst { Worker } = require('worker_threads'); 61cb0ef41Sopenharmony_ciconst { once } = require('events'); 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ci(async function() { 91cb0ef41Sopenharmony_ci const w = new Worker('setInterval(() => {}, 100)', { eval: true }); 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ci await once(w, 'online'); 121cb0ef41Sopenharmony_ci const stream = await w.getHeapSnapshot(); 131cb0ef41Sopenharmony_ci const snapshot = recordState(stream); 141cb0ef41Sopenharmony_ci snapshot.validateSnapshot('Node / MessagePort', [ 151cb0ef41Sopenharmony_ci { 161cb0ef41Sopenharmony_ci children: [ 171cb0ef41Sopenharmony_ci { node_name: 'Node / MessagePortData', edge_name: 'data' }, 181cb0ef41Sopenharmony_ci ], 191cb0ef41Sopenharmony_ci }, 201cb0ef41Sopenharmony_ci ], { loose: true }); 211cb0ef41Sopenharmony_ci await w.terminate(); 221cb0ef41Sopenharmony_ci})().then(common.mustCall()); 23