11cb0ef41Sopenharmony_ciimport { mustCall } from '../common/index.mjs';
21cb0ef41Sopenharmony_ciimport { Worker, isMainThread } from 'worker_threads';
31cb0ef41Sopenharmony_ciimport assert from 'assert';
41cb0ef41Sopenharmony_ciimport { fileURLToPath } from 'url';
51cb0ef41Sopenharmony_ciimport { requireFixture, importFixture } from '../fixtures/pkgexports.mjs';
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ciif (isMainThread) {
81cb0ef41Sopenharmony_ci  const tests = [[], ['--no-addons']];
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_ci  for (const execArgv of tests) {
111cb0ef41Sopenharmony_ci    new Worker(fileURLToPath(import.meta.url), { execArgv });
121cb0ef41Sopenharmony_ci  }
131cb0ef41Sopenharmony_ci} else {
141cb0ef41Sopenharmony_ci  [requireFixture, importFixture].forEach((loadFixture) => {
151cb0ef41Sopenharmony_ci    loadFixture('pkgexports/no-addons').then(
161cb0ef41Sopenharmony_ci      mustCall((module) => {
171cb0ef41Sopenharmony_ci        const message = module.default;
181cb0ef41Sopenharmony_ci
191cb0ef41Sopenharmony_ci        if (process.execArgv.length === 0) {
201cb0ef41Sopenharmony_ci          assert.strictEqual(message, 'using native addons');
211cb0ef41Sopenharmony_ci        } else {
221cb0ef41Sopenharmony_ci          assert.strictEqual(message, 'not using native addons');
231cb0ef41Sopenharmony_ci        }
241cb0ef41Sopenharmony_ci      })
251cb0ef41Sopenharmony_ci    );
261cb0ef41Sopenharmony_ci  });
271cb0ef41Sopenharmony_ci}
28