asyncHelpers-throwsAsync-custom.js (522B)
1 // |reftest| async 2 // Copyright (C) 2022 Igalia, S.L. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 /*--- 5 description: | 6 Thenables that reject with values of the specified constructor function 7 satisfy the assertion. 8 flags: [async] 9 includes: [asyncHelpers.js] 10 ---*/ 11 12 function MyError() {} 13 14 asyncTest(async function () { 15 const p = assert.throwsAsync(MyError, function () { 16 return Promise.reject(new MyError()); 17 }); 18 assert(p instanceof Promise); 19 await p; 20 });