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

Function testAbortMidCompression

test/parallel/test-stream-iter-transform-coverage.js:32–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30
31// Abort mid-compression triggers finally cleanup
32async function testAbortMidCompression() {
33 const ac = new AbortController();
34 const largeInput = 'x'.repeat(100_000);
35 const compressed = pull(from(largeInput), compressGzip(),
36 { signal: ac.signal });
37 const iter = compressed[Symbol.asyncIterator]();
38
39 // Read one batch then abort
40 const first = await iter.next();
41 assert.strictEqual(first.done, false);
42 ac.abort();
43 await assert.rejects(iter.next(), { name: 'AbortError' });
44}
45
46// Early consumer exit (break from for-await) triggers finally
47async function testEarlyConsumerExit() {

Calls 5

abortMethod · 0.95
compressGzipFunction · 0.85
pullFunction · 0.70
nextMethod · 0.65
fromFunction · 0.50

Tested by

no test coverage detected