node/test/es-module/test-esm-no-addons.mjs
Carlos Espa 69502d8835
test: change jenkins reporter
PR-URL: https://github.com/nodejs/node/pull/56808
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2025-02-03 14:30:34 +00:00

26 lines
827 B
JavaScript

import { mustCall } from '../common/index.mjs';
import { Worker, isMainThread } from 'worker_threads';
import assert from 'assert';
import { fileURLToPath } from 'url';
import { requireFixture, importFixture } from '../fixtures/pkgexports.mjs';
if (isMainThread) {
const tests = [[], ['--no-addons']];
for (const execArgv of tests) {
new Worker(fileURLToPath(import.meta.url), { execArgv });
}
} else {
[requireFixture, importFixture].forEach((loadFixture) => {
loadFixture('pkgexports/no-addons').then(
mustCall((module) => {
const message = module.default;
if (!process.execArgv.includes('--no-addons')) {
assert.strictEqual(message, 'using native addons');
} else {
assert.strictEqual(message, 'not using native addons');
}
})
);
});
}