()
| 116 | } |
| 117 | |
| 118 | async function testShareCancelWithReason() { |
| 119 | const shared = share(from('data')); |
| 120 | const consumer = shared.pull(); |
| 121 | |
| 122 | shared.cancel(new Error('share cancelled')); |
| 123 | |
| 124 | await assert.rejects( |
| 125 | async () => { |
| 126 | // eslint-disable-next-line no-unused-vars |
| 127 | for await (const _ of consumer) { |
| 128 | assert.fail('Should not reach here'); |
| 129 | } |
| 130 | }, |
| 131 | { message: 'share cancelled' }, |
| 132 | ); |
| 133 | } |
| 134 | |
| 135 | async function testShareAbortSignal() { |
| 136 | const ac = new AbortController(); |