()
| 30 | |
| 31 | // Abort mid-compression triggers finally cleanup |
| 32 | async 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 |
| 47 | async function testEarlyConsumerExit() { |
no test coverage detected