• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../../common');
3
4// Refs: https://github.com/nodejs/node/issues/34731
5// Refs: https://github.com/nodejs/node/pull/35777
6// Refs: https://github.com/nodejs/node/issues/35778
7
8const { Worker, isMainThread } = require('worker_threads');
9
10if (isMainThread) {
11  const worker = new Worker(__filename);
12  worker.on('error', common.mustNotCall());
13} else {
14  const { Test } =
15    require(`./build/${common.buildType}/test_worker_terminate_finalization`);
16
17  // Spin up thread and call add-on create the right sequence
18  // of rerences to hit the case reported in
19  // https://github.com/nodejs/node-addon-api/issues/722
20  // will crash if run under debug and its not possible to
21  // create object in the specific finalizer
22  Test(new Object());
23}
24