()
| 109 | } |
| 110 | |
| 111 | async function testMergeConsumerBreak() { |
| 112 | let source1Return = false; |
| 113 | let source2Return = false; |
| 114 | async function* source1() { |
| 115 | try { |
| 116 | while (true) yield [new TextEncoder().encode('a')]; |
| 117 | } finally { |
| 118 | source1Return = true; |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | async function* source2() { |
| 123 | try { |
| 124 | while (true) yield [new TextEncoder().encode('b')]; |
| 125 | } finally { |
| 126 | source2Return = true; |
| 127 | } |
| 128 | } |
| 129 | // eslint-disable-next-line no-unused-vars |
| 130 | for await (const _ of merge(source1(), source2())) { |
| 131 | break; // Break after first batch |
| 132 | } |
| 133 | // Give async cleanup a tick to complete |
| 134 | await new Promise(setImmediate); |
| 135 | // Both sources should be cleaned up |
| 136 | assert.strictEqual(source1Return && source2Return, true); |
| 137 | } |
| 138 | |
| 139 | async function testMergeSignalMidIteration() { |
| 140 | const ac = new AbortController(); |
no test coverage detected