asyncHelpers-throwsAsync-no-arg.js (748B)
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 The assertion fails when invoked without arguments. 7 flags: [async] 8 includes: [asyncHelpers.js] 9 ---*/ 10 11 asyncTest(async function () { 12 var caught = false; 13 14 const p = assert.throwsAsync(); 15 assert(p instanceof Promise); 16 try { 17 await p; 18 } catch (err) { 19 caught = true; 20 assert.sameValue( 21 err.constructor, 22 Test262Error, 23 "Expected a Test262Error, but a '" + 24 err.constructor.name + 25 "' was thrown." 26 ); 27 } finally { 28 assert( 29 caught, 30 "assert.throwsAsync did not reject when invoked without arguments" 31 ); 32 } 33 });