Something went wrong. Try again.
Offload functions to worker threads with shared memory primitives for Node.js.
Something went wrong. Try again.
12345678910111213141516171819202122232425262728import { describe, it } from 'node:test';import assert from 'node:assert/strict';import { double, add } from './fixtures/math.ts';
describe('dedicated runner', () => { it('executes a moroutine on a worker thread', async () => { const result = await double(2); assert.equal(result, 4); });
it('handles multiple arguments', async () => { const result = await add(3, 4); assert.equal(result, 7); });
it('handles sequential calls', async () => { const a = await double(5); const b = await double(10); assert.equal(a, 10); assert.equal(b, 20); });
it('handles concurrent calls', async () => { const results = await Promise.all([double(1), double(2), double(3)]); assert.deepEqual(results, [2, 4, 6]); });});