mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
a9dd03b1ec
PR-URL: https://github.com/nodejs/node/pull/39977 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
30 lines
824 B
JavaScript
30 lines
824 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const fixtures = require('../common/fixtures');
|
|
const { Worker, isMainThread, parentPort } = require('worker_threads');
|
|
const assert = require('assert');
|
|
const { createRequire } = require('module');
|
|
|
|
const loadFixture = createRequire(fixtures.path('node_modules'));
|
|
|
|
if (isMainThread) {
|
|
const tests = [[], ['--no-addons']];
|
|
|
|
for (const execArgv of tests) {
|
|
const worker = new Worker(__filename, { execArgv });
|
|
|
|
worker.on('message', common.mustCall((message) => {
|
|
if (execArgv.length === 0) {
|
|
assert.strictEqual(message, 'using native addons');
|
|
} else {
|
|
assert.strictEqual(message, 'not using native addons');
|
|
}
|
|
}));
|
|
}
|
|
|
|
} else {
|
|
const message = loadFixture('pkgexports/no-addons');
|
|
parentPort.postMessage(message);
|
|
}
|