1'use strict'; 2const common = require('../common'); 3const assert = require('assert'); 4const { Worker } = require('worker_threads'); 5const { once } = require('events'); 6 7(async function() { 8 const w = new Worker('', { eval: true }); 9 10 await once(w, 'exit'); 11 await assert.rejects(() => w.getHeapSnapshot(), { 12 name: 'Error', 13 code: 'ERR_WORKER_NOT_RUNNING' 14 }); 15})().then(common.mustCall()); 16