MCPcopy Create free account
hub / github.com/nodejs/node / testErrorSync

Function testErrorSync

test/parallel/test-stream-iter-to-readable.js:459–473  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

457// =============================================================================
458
459async function testErrorSync() {
460 function* gen() {
461 yield [Buffer.from('ok')];
462 throw new Error('sync source failed');
463 }
464
465 const readable = toReadableSync(gen());
466
467 await assert.rejects(async () => {
468 // eslint-disable-next-line no-unused-vars
469 for await (const chunk of readable) {
470 // Consume until error
471 }
472 }, { message: 'sync source failed' });
473}
474
475// =============================================================================
476// fromStreamIterSync: empty source

Callers 1

Calls 2

toReadableSyncFunction · 0.85
genFunction · 0.70

Tested by

no test coverage detected