sync-iterable-with-rejecting-thenable-rejects.js (599B)
1 // |reftest| async 2 // Copyright (C) 2023 Igalia, S.L. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-array.fromasync 7 description: Result promise rejects if then method of input fails. 8 includes: [asyncHelpers.js] 9 flags: [async] 10 features: [Array.fromAsync] 11 ---*/ 12 13 asyncTest(async function () { 14 const inputThenable = { 15 then (resolve, reject) { 16 reject(new Test262Error); 17 }, 18 }; 19 const input = [ inputThenable ].values(); 20 const output = Array.fromAsync(input); 21 await assert.throwsAsync(Test262Error, () => output); 22 });