()
| 566 | // ============================================================================= |
| 567 | |
| 568 | async function testAbortSignal() { |
| 569 | let pushCount = 0; |
| 570 | const readable = new Readable({ |
| 571 | read() { |
| 572 | this.push(Buffer.from(`sig${pushCount++}`)); |
| 573 | // Never pushes null - infinite stream |
| 574 | }, |
| 575 | }); |
| 576 | |
| 577 | const ac = new AbortController(); |
| 578 | const chunks = []; |
| 579 | |
| 580 | await assert.rejects(async () => { |
| 581 | for await (const batch of pull(readable, { signal: ac.signal })) { |
| 582 | chunks.push(...batch); |
| 583 | if (chunks.length >= 2) { |
| 584 | ac.abort(); |
| 585 | } |
| 586 | } |
| 587 | }, { name: 'AbortError' }); |
| 588 | assert.ok(chunks.length >= 2); |
| 589 | } |
| 590 | |
| 591 | // ============================================================================= |
| 592 | // kValidatedSource identity - from() returns same object for validated sources |
no test coverage detected