xref: /third_party/node/test/addons/hello-world/test-worker.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/addons/hello-world/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../../common');
31cb0ef41Sopenharmony_ciconst assert = require('assert');
41cb0ef41Sopenharmony_ciconst path = require('path');
51cb0ef41Sopenharmony_ciconst { Worker } = require('worker_threads');
61cb0ef41Sopenharmony_ciconst binding = path.resolve(__dirname, `./build/${common.buildType}/binding`);
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ciconst w = new Worker(`
91cb0ef41Sopenharmony_cirequire('worker_threads').parentPort.postMessage(
101cb0ef41Sopenharmony_ci  require(${JSON.stringify(binding)}).hello());`, { eval: true });
111cb0ef41Sopenharmony_ciw.on('message', common.mustCall((message) => {
121cb0ef41Sopenharmony_ci  assert.strictEqual(message, 'world');
131cb0ef41Sopenharmony_ci}));
14

Indexes created Thu Nov 07 10:32:03 CST 2024