Nicolò Ribaudo d25262ec4b
Correctly delegate .return() in async generator (#10422)
* Correctly delegate .return() in async generator

* Add catch param

* minNodeVersion

* Add another test
2019-11-05 00:35:40 +01:00

20 lines
287 B
JavaScript

const log = [];
async function* func1() {
log.push(1);
yield "a";
log.push(2);
}
async function* func2() {
yield* func1();
log.push(3);
}
return (async () => {
const iterator = func2();
await iterator.next();
await iterator.return();
expect(log).toEqual([1]);
})();