()
| 85 | // ============================================================================= |
| 86 | |
| 87 | async function testMergeSourceError() { |
| 88 | async function* goodSource() { |
| 89 | const enc = new TextEncoder(); |
| 90 | yield [enc.encode('a')]; |
| 91 | // Slow so the bad source errors first |
| 92 | await new Promise((r) => setTimeout(r, 50)); |
| 93 | yield [enc.encode('b')]; |
| 94 | } |
| 95 | |
| 96 | async function* badSource() { |
| 97 | yield [new TextEncoder().encode('x')]; |
| 98 | throw new Error('merge source boom'); |
| 99 | } |
| 100 | await assert.rejects( |
| 101 | async () => { |
| 102 | // eslint-disable-next-line no-unused-vars |
| 103 | for await (const _ of merge(goodSource(), badSource())) { |
| 104 | /* consume */ |
| 105 | } |
| 106 | }, |
| 107 | { message: 'merge source boom' }, |
| 108 | ); |
| 109 | } |
| 110 | |
| 111 | async function testMergeConsumerBreak() { |
| 112 | let source1Return = false; |
no test coverage detected