mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
4f434187ff
PR-URL: https://github.com/nodejs/node/pull/30125 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
22 lines
711 B
JavaScript
22 lines
711 B
JavaScript
'use strict';
|
|
const common = require('../../common');
|
|
|
|
if (common.isWindows)
|
|
common.skip('dlopen global symbol loading is not supported on this os.');
|
|
|
|
const assert = require('assert');
|
|
const { Worker } = require('worker_threads');
|
|
|
|
// Check that modules that are not declared as context-aware cannot be re-loaded
|
|
// from workers.
|
|
|
|
const bindingPath = require.resolve(`./build/${common.buildType}/binding`);
|
|
require(bindingPath);
|
|
|
|
new Worker(`require(${JSON.stringify(bindingPath)})`, { eval: true })
|
|
.on('error', common.mustCall((err) => {
|
|
assert.strictEqual(err.constructor, Error);
|
|
assert.strictEqual(err.message,
|
|
`Module did not self-register: '${bindingPath}'.`);
|
|
}));
|