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

Function testErrorAsync

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

Source from the content-addressed store, hash-verified

90// =============================================================================
91
92async function testErrorAsync() {
93 async function* gen() {
94 yield [Buffer.from('ok')];
95 throw new Error('source failed');
96 }
97
98 const readable = toReadable(gen());
99
100 await assert.rejects(async () => {
101 // eslint-disable-next-line no-unused-vars
102 for await (const chunk of readable) {
103 // Consume until error
104 }
105 }, { message: 'source failed' });
106}
107
108// =============================================================================
109// fromStreamIter: empty source

Callers 1

Calls 2

toReadableFunction · 0.85
genFunction · 0.70

Tested by

no test coverage detected