MCPcopy Index your code
hub / github.com/nodejs/node / testAbortSignal

Function testAbortSignal

test/parallel/test-stream-iter-broadcast-from.js:66–79  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

64// =============================================================================
65
66async function testAbortSignal() {
67 const ac = new AbortController();
68 const { broadcast: bc } = broadcast({ signal: ac.signal });
69 const consumer = bc.push();
70
71 ac.abort();
72
73 await assert.rejects(async () => {
74 // eslint-disable-next-line no-unused-vars
75 for await (const _ of consumer) {
76 assert.fail('Should not reach here');
77 }
78 }, { name: 'AbortError' });
79}
80
81async function testAlreadyAbortedSignal() {
82 const { broadcast: bc } = broadcast({ signal: AbortSignal.abort() });

Calls 4

abortMethod · 0.95
broadcastFunction · 0.50
pushMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected