1'use strict'; 2const common = require('../common'); 3const { Worker } = require('worker_threads'); 4 5// Like test-async-hooks-worker-promise.js but with the `await` and `createHook` 6// lines switched, because that resulted in different assertion failures 7// (one a Node.js assertion and one a V8 DCHECK) and it seems prudent to 8// cover both of those failures. 9 10const w = new Worker(` 11const { createHook } = require('async_hooks'); 12 13setImmediate(async () => { 14 await 0; 15 createHook({ init() {} }).enable(); 16 process.exit(); 17}); 18`, { eval: true }); 19 20w.postMessage({}); 21w.on('exit', common.mustCall()); 22