11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../../common'); 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_ciif (common.isWindows) 51cb0ef41Sopenharmony_ci common.skip('dlopen global symbol loading is not supported on this os.'); 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ciconst assert = require('assert'); 81cb0ef41Sopenharmony_ciconst { Worker } = require('worker_threads'); 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ci// Check that modules that are not declared as context-aware cannot be re-loaded 111cb0ef41Sopenharmony_ci// from workers. 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ciconst bindingPath = require.resolve(`./build/${common.buildType}/binding`); 141cb0ef41Sopenharmony_cirequire(bindingPath); 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_cinew Worker(`require(${JSON.stringify(bindingPath)})`, { eval: true }) 171cb0ef41Sopenharmony_ci .on('error', common.mustCall((err) => { 181cb0ef41Sopenharmony_ci assert.strictEqual(err.constructor, Error); 191cb0ef41Sopenharmony_ci assert.strictEqual(err.message, 201cb0ef41Sopenharmony_ci `Module did not self-register: '${bindingPath}'.`); 211cb0ef41Sopenharmony_ci })); 22