()
| 197 | // Cleanup error with no primary error: iterator.return() throws during |
| 198 | // normal completion. The cleanup error should propagate directly. |
| 199 | async function testMergeCleanupErrorOnly() { |
| 200 | async function* source() { |
| 201 | yield [new TextEncoder().encode('data')]; |
| 202 | } |
| 203 | |
| 204 | async function* failingReturnSource() { |
| 205 | try { |
| 206 | yield [new TextEncoder().encode('more')]; |
| 207 | } finally { |
| 208 | throwInFinally('cleanup boom'); |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | await assert.rejects( |
| 213 | async () => { |
| 214 | // eslint-disable-next-line no-unused-vars |
| 215 | for await (const _ of merge(source(), failingReturnSource())) { |
| 216 | // Consume all - no primary error |
| 217 | } |
| 218 | }, |
| 219 | { message: 'cleanup boom' }, |
| 220 | ); |
| 221 | } |
| 222 | |
| 223 | // Primary error + cleanup error: a source throws during iteration AND |
| 224 | // iterator.return() also throws. Should get a SuppressedError. |
no test coverage detected