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

Function testAbortSignal

test/parallel/test-stream-iter-duplex.js:112–128  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

110}
111
112async function testAbortSignal() {
113 const ac = new AbortController();
114 const [channelA] = duplex({ signal: ac.signal });
115
116 ac.abort();
117
118 // Both directions should error
119 await assert.rejects(
120 async () => {
121 // eslint-disable-next-line no-unused-vars
122 for await (const _ of channelA.readable) {
123 assert.fail('Should not reach here');
124 }
125 },
126 (err) => err.name === 'AbortError',
127 );
128}
129
130async function testEmptyDuplex() {
131 const [channelA, channelB] = duplex();

Callers 1

Calls 3

abortMethod · 0.95
duplexFunction · 0.85
failMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…