asyncHelpers-asyncTest-without-async-flag.js (670B)
1 // Copyright (C) 2022 Igalia, S.L. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 description: | 5 The 'asyncTest' helper checks that it is called with the 'async' flag. 6 includes: [asyncHelpers.js] 7 ---*/ 8 function makePromise() { 9 return { 10 then(res, rej) { 11 // Throw a different error than Test262Error to avoid confusion about what is rejecting 12 throw new Error("Should not be evaluated"); 13 }, 14 }; 15 } 16 assert( 17 !Object.hasOwn(globalThis, "$DONE"), 18 "Without 'async' flag, $DONE should not be defined" 19 ); 20 assert.throws(Test262Error, function () { 21 asyncTest(makePromise); 22 }); 23 24 reportCompare(0, 0);