mirror of https://gitee.com/openkylin/nodejs.git
16 lines
406 B
JavaScript
16 lines
406 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const fixtures = require('../common/fixtures');
|
|
const assert = require('assert');
|
|
const { Worker } = require('worker_threads');
|
|
|
|
const workerData = 'Hello from main thread';
|
|
|
|
const worker = new Worker(fixtures.path('worker-data.mjs'), {
|
|
workerData
|
|
});
|
|
|
|
worker.on('message', common.mustCall((message) => {
|
|
assert.strictEqual(message, workerData);
|
|
}));
|