11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciconst common = require('../common');
41cb0ef41Sopenharmony_ciconst fixtures = require('../common/fixtures');
51cb0ef41Sopenharmony_ciconst { Worker, isMainThread, parentPort } = require('worker_threads');
61cb0ef41Sopenharmony_ciconst assert = require('assert');
71cb0ef41Sopenharmony_ciconst { createRequire } = require('module');
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ciconst loadFixture = createRequire(fixtures.path('node_modules'));
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ciif (isMainThread) {
121cb0ef41Sopenharmony_ci  const tests = [[], ['--no-addons']];
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ci  for (const execArgv of tests) {
151cb0ef41Sopenharmony_ci    const worker = new Worker(__filename, { execArgv });
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_ci    worker.on('message', common.mustCall((message) => {
181cb0ef41Sopenharmony_ci      if (execArgv.length === 0) {
191cb0ef41Sopenharmony_ci        assert.strictEqual(message, 'using native addons');
201cb0ef41Sopenharmony_ci      } else {
211cb0ef41Sopenharmony_ci        assert.strictEqual(message, 'not using native addons');
221cb0ef41Sopenharmony_ci      }
231cb0ef41Sopenharmony_ci    }));
241cb0ef41Sopenharmony_ci  }
251cb0ef41Sopenharmony_ci
261cb0ef41Sopenharmony_ci} else {
271cb0ef41Sopenharmony_ci  const message = loadFixture('pkgexports/no-addons');
281cb0ef41Sopenharmony_ci  parentPort.postMessage(message);
291cb0ef41Sopenharmony_ci}
30