Skip to content

Commit

Permalink
test: fix buildType bug objectwrap_worker_thread
Browse files Browse the repository at this point in the history
Since worker threads inherit non-process-specific options by
default, the configuration needs to be shared via workerData.

PR-URL: #837
Fixes: #834
Reviewed-By: Michael Dawson <midawson@redhat.com>
  • Loading branch information
RaisinTen authored and mhdawson committed Nov 23, 2020
1 parent 6321f2b commit 63b43f4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/objectwrap_worker_thread.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
'use strict';
const buildType = process.config.target_defaults.default_configuration;
const { Worker, isMainThread } = require('worker_threads');
const { Worker, isMainThread, workerData } = require('worker_threads');

if (isMainThread) {
new Worker(__filename);
const buildType = process.config.target_defaults.default_configuration;
new Worker(__filename, { workerData: buildType });
} else {
const test = binding => {
new binding.objectwrap.Test();
};

const buildType = workerData;
test(require(`./build/${buildType}/binding.node`));
test(require(`./build/${buildType}/binding_noexcept.node`));
}

0 comments on commit 63b43f4

Please sign in to comment.