Backed out 3 changesets (bug 1892041) for causing failures on async-module-does-not...
[gecko.git] / js / src / tests / test262 / built-ins / Array / fromAsync / mapfn-async-throws.js
blob663e2c9338c2c507946fc06fd68e88fe8c54c40b
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.
5 /*---
6 esid: sec-array.fromasync
7 description: >
8   The output promise rejects if the asynchronous mapping function rejects.
9 info: |
10   3.j.ii.6. If _mapping_ is *true*, then
11     a. Let _mappedValue_ be Call(_mapfn_, _thisArg_, « _nextValue_, 𝔽(_k_) »).
12     ...
13     c. Set _mappedValue_ to Await(_mappedValue_).
14     d. IfAbruptCloseAsyncIterator(_mappedValue_, _iteratorRecord_).
15 flags: [async]
16 includes: [asyncHelpers.js]
17 features: [Array.fromAsync]
18 ---*/
20 asyncTest(async () => {
21   await assert.throwsAsync(Test262Error, () => Array.fromAsync([1, 2, 3], async () => {
22     throw new Test262Error("mapfn throws");
23   }), "async mapfn rejecting should cause fromAsync to reject");
24 });