Offload functions to worker threads with shared memory primitives for Node.js.
8
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 22 lines 649 B view raw
1import { describe, it } from 'node:test'; 2import assert from 'node:assert/strict'; 3 4describe('channel()', () => { 5 it('returns an object with the channel marker', async () => { 6 const { channel } = await import('../src/channel.ts'); 7 async function* gen() { 8 yield 1; 9 } 10 const wrapped = channel(gen()); 11 assert.ok(Symbol.for('moroutine.channel') in (wrapped as any)); 12 }); 13 14 it('accepts highWaterMark option', async () => { 15 const { channel } = await import('../src/channel.ts'); 16 async function* gen() { 17 yield 1; 18 } 19 const wrapped = channel(gen(), { highWaterMark: 32 }); 20 assert.ok(wrapped); 21 }); 22});