11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common'); 31cb0ef41Sopenharmony_ciconst { Worker } = require('worker_threads'); 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci// Like test-async-hooks-worker-promise.js but with the `await` and `createHook` 61cb0ef41Sopenharmony_ci// lines switched, because that resulted in different assertion failures 71cb0ef41Sopenharmony_ci// (one a Node.js assertion and one a V8 DCHECK) and it seems prudent to 81cb0ef41Sopenharmony_ci// cover both of those failures. 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ciconst w = new Worker(` 111cb0ef41Sopenharmony_ciconst { createHook } = require('async_hooks'); 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_cisetImmediate(async () => { 141cb0ef41Sopenharmony_ci await 0; 151cb0ef41Sopenharmony_ci createHook({ init() {} }).enable(); 161cb0ef41Sopenharmony_ci process.exit(); 171cb0ef41Sopenharmony_ci}); 181cb0ef41Sopenharmony_ci`, { eval: true }); 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_ciw.postMessage({}); 211cb0ef41Sopenharmony_ciw.on('exit', common.mustCall()); 22