11cb0ef41Sopenharmony_ci// Flags: --experimental-loader ./test/fixtures/es-module-loaders/loader-side-effect.mjs --require ./test/fixtures/es-module-loaders/loader-side-effect-require-preload.js 21cb0ef41Sopenharmony_ciimport { allowGlobals, mustCall } from '../common/index.mjs'; 31cb0ef41Sopenharmony_ciimport assert from 'assert'; 41cb0ef41Sopenharmony_ciimport { fileURLToPath } from 'url'; 51cb0ef41Sopenharmony_ciimport { Worker, isMainThread, parentPort } from 'worker_threads'; 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ci/* global implicitGlobalProperty */ 81cb0ef41Sopenharmony_ciassert.strictEqual(globalThis.implicitGlobalProperty, 42); 91cb0ef41Sopenharmony_ciallowGlobals(implicitGlobalProperty); 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ci/* global implicitGlobalConst */ 121cb0ef41Sopenharmony_ciassert.strictEqual(implicitGlobalConst, 42 * 42); 131cb0ef41Sopenharmony_ciallowGlobals(implicitGlobalConst); 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_ci/* global explicitGlobalProperty */ 161cb0ef41Sopenharmony_ciassert.strictEqual(globalThis.explicitGlobalProperty, 42 * 42 * 42); 171cb0ef41Sopenharmony_ciallowGlobals(explicitGlobalProperty); 181cb0ef41Sopenharmony_ci 191cb0ef41Sopenharmony_ci/* global preloadOrder */ 201cb0ef41Sopenharmony_ciassert.deepStrictEqual(globalThis.preloadOrder, ['--require', 'loader']); 211cb0ef41Sopenharmony_ciallowGlobals(preloadOrder); 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_ciif (isMainThread) { 241cb0ef41Sopenharmony_ci const worker = new Worker(fileURLToPath(import.meta.url)); 251cb0ef41Sopenharmony_ci const promise = new Promise((resolve, reject) => { 261cb0ef41Sopenharmony_ci worker.on('message', resolve); 271cb0ef41Sopenharmony_ci worker.on('error', reject); 281cb0ef41Sopenharmony_ci }); 291cb0ef41Sopenharmony_ci promise.then(mustCall()); 301cb0ef41Sopenharmony_ci} else { 311cb0ef41Sopenharmony_ci parentPort.postMessage('worker done'); 321cb0ef41Sopenharmony_ci} 33