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

Function testAbortSignalBothChannels

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

Source from the content-addressed store, hash-verified

154
155// Abort signal affects both channels
156async function testAbortSignalBothChannels() {
157 const ac = new AbortController();
158 const [channelA, channelB] = duplex({ signal: ac.signal });
159
160 ac.abort();
161
162 await assert.rejects(async () => {
163 // eslint-disable-next-line no-unused-vars
164 for await (const _ of channelA.readable) {
165 assert.fail('Should not reach here');
166 }
167 }, (err) => err.name === 'AbortError');
168
169 await assert.rejects(async () => {
170 // eslint-disable-next-line no-unused-vars
171 for await (const _ of channelB.readable) {
172 assert.fail('Should not reach here');
173 }
174 }, (err) => err.name === 'AbortError');
175}
176
177Promise.all([
178 testBasicDuplex(),

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…