Skip to content

Commit 63b43f4

Browse files
RaisinTenmhdawson
authored andcommitted
test: fix buildType bug objectwrap_worker_thread
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 <[email protected]>
1 parent 6321f2b commit 63b43f4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

test/objectwrap_worker_thread.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
'use strict';
2-
const buildType = process.config.target_defaults.default_configuration;
3-
const { Worker, isMainThread } = require('worker_threads');
2+
const { Worker, isMainThread, workerData } = require('worker_threads');
43

54
if (isMainThread) {
6-
new Worker(__filename);
5+
const buildType = process.config.target_defaults.default_configuration;
6+
new Worker(__filename, { workerData: buildType });
77
} else {
88
const test = binding => {
99
new binding.objectwrap.Test();
1010
};
1111

12+
const buildType = workerData;
1213
test(require(`./build/${buildType}/binding.node`));
1314
test(require(`./build/${buildType}/binding_noexcept.node`));
1415
}

0 commit comments

Comments
 (0)