1'use strict'; 2const common = require('../../common'); 3 4if (common.isWindows) 5 common.skip('dlopen global symbol loading is not supported on this os.'); 6 7const assert = require('assert'); 8const { Worker } = require('worker_threads'); 9 10// Check that modules that are not declared as context-aware cannot be re-loaded 11// from workers. 12 13const bindingPath = require.resolve(`./build/${common.buildType}/binding`); 14require(bindingPath); 15 16new Worker(`require(${JSON.stringify(bindingPath)})`, { eval: true }) 17 .on('error', common.mustCall((err) => { 18 assert.strictEqual(err.constructor, Error); 19 assert.strictEqual(err.message, 20 `Module did not self-register: '${bindingPath}'.`); 21 })); 22