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

Function testWriteWithSignalRejects

test/parallel/test-stream-iter-push-writer.js:41–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

39}
40
41async function testWriteWithSignalRejects() {
42 const { writer, readable } = push({ highWaterMark: 1 });
43
44 // Fill the buffer so write will block
45 writer.writeSync('a');
46
47 const ac = new AbortController();
48 const writePromise = writer.write('b', { signal: ac.signal });
49
50 // Signal fires while write is pending
51 ac.abort();
52
53 await assert.rejects(writePromise, { name: 'AbortError' });
54
55 // Clean up
56 writer.end();
57 // eslint-disable-next-line no-unused-vars
58 for await (const _ of readable) { break; }
59}
60
61async function testWriteWithPreAbortedSignal() {
62 const { writer, readable } = push({ highWaterMark: 1 });

Callers 1

Calls 5

abortMethod · 0.95
pushFunction · 0.70
writeSyncMethod · 0.45
writeMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…