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

Function testConsumerThrowRejectsWrites

test/parallel/test-stream-iter-push-writer.js:279–291  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

277
278// Consumer throw causes subsequent writes to reject with consumer's error
279async function testConsumerThrowRejectsWrites() {
280 const { writer, readable } = push({ highWaterMark: 1 });
281 writer.writeSync('a');
282
283 const iter = readable[Symbol.asyncIterator]();
284 await iter.throw(new Error('consumer boom'));
285
286 // Subsequent async writes should reject with the consumer's error
287 await assert.rejects(
288 () => writer.write('x'),
289 { message: 'consumer boom' },
290 );
291}
292
293// end() resolves a pending read as done:true
294async function testEndResolvesPendingRead() {

Callers 1

Calls 4

pushFunction · 0.70
writeSyncMethod · 0.45
throwMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…