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

Function testPipeToWithSignal

test/parallel/test-stream-iter-pipeto.js:88–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

86
87// PipeTo with AbortSignal
88async function testPipeToWithSignal() {
89 const ac = new AbortController();
90 const chunks = [];
91 const writer = {
92 write(chunk) { chunks.push(chunk); },
93 };
94 async function* slowSource() {
95 yield [new TextEncoder().encode('a')];
96 await new Promise((r) => setTimeout(r, 50));
97 yield [new TextEncoder().encode('b')];
98 }
99 ac.abort();
100 await assert.rejects(
101 () => pipeTo(slowSource(), writer, { signal: ac.signal }),
102 { name: 'AbortError' },
103 );
104}
105
106// PipeTo with transforms
107async function testPipeToWithTransforms() {

Callers 1

Calls 3

abortMethod · 0.95
pipeToFunction · 0.85
slowSourceFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…