Split the tests so that it's easier to isolate and debug issues, and we can run the test cases in parallel to speed up. Also add more comments about what they are testing. PR-URL: https://github.com/nodejs/node/pull/61571 Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
22 lines
614 B
JavaScript
22 lines
614 B
JavaScript
const {
|
|
setDeserializeMainFunction,
|
|
} = require('v8').startupSnapshot;
|
|
const assert = require('assert');
|
|
|
|
setDeserializeMainFunction(() => {
|
|
const { Worker } = require('worker_threads');
|
|
const worker = new Worker(
|
|
'require("worker_threads").parentPort.postMessage({value: 21 + 21})',
|
|
{ eval: true });
|
|
|
|
const messages = [];
|
|
worker.on('message', (message) => {
|
|
console.log('Worker message:', message);
|
|
messages.push(message);
|
|
});
|
|
|
|
process.on('beforeExit', () => {
|
|
console.log('Process beforeExit, messages:', messages);
|
|
assert.deepStrictEqual(messages, [{value:42}]);
|
|
});
|
|
});
|