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

Function testAsyncIteratorThrow

test/parallel/test-stream-iter-share-coverage.js:68–77  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

66
67// Async consumer iterator throw()
68async function testAsyncIteratorThrow() {
69 const shared = share(from('throw-test'));
70 const consumer = shared.pull();
71 const iter = consumer[Symbol.asyncIterator]();
72 const first = await iter.next();
73 assert.strictEqual(first.done, false);
74 const result = await iter.throw(new Error('test-throw'));
75 assert.strictEqual(result.done, true);
76 assert.strictEqual(shared.consumerCount, 0);
77}
78
79// Sync consumer iterator throw()
80async function testSyncIteratorThrow() {

Calls 5

shareFunction · 0.85
nextMethod · 0.65
fromFunction · 0.50
pullMethod · 0.45
throwMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…