MCPcopy Index your code
hub / github.com/nodejs/node / testShareSourceError

Function testShareSourceError

test/parallel/test-stream-iter-share-async.js:215–232  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

213// =============================================================================
214
215async function testShareSourceError() {
216 async function* failingSource() {
217 yield [new TextEncoder().encode('a')];
218 throw new Error('share source boom');
219 }
220 const shared = share(failingSource());
221 const c1 = shared.pull();
222 const c2 = shared.pull();
223
224 await assert.rejects(async () => {
225 // eslint-disable-next-line no-unused-vars
226 for await (const _ of c1) { /* consume */ }
227 }, { message: 'share source boom' });
228 await assert.rejects(async () => {
229 // eslint-disable-next-line no-unused-vars
230 for await (const _ of c2) { /* consume */ }
231 }, { message: 'share source boom' });
232}
233
234async function testShareLateJoiningConsumer() {
235 // A consumer that joins after some data has been consumed should only

Callers 1

Calls 3

shareFunction · 0.85
failingSourceFunction · 0.70
pullMethod · 0.45

Tested by

no test coverage detected