summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/harness/asyncHelpers-throwsAsync-custom.js
blob: 44614a4f7fe8cffb6176845efd3bd4cc11f9ae05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// |reftest| async
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
    Thenables that reject with values of the specified constructor function
    satisfy the assertion.
flags: [async]
includes: [asyncHelpers.js]
---*/

function MyError() {}

asyncTest(async function () {
  const p = assert.throwsAsync(MyError, function () {
    return Promise.reject(new MyError());
  });
  assert(p instanceof Promise);
  await p;
});