mirror of
https://github.com/tc39/test262.git
synced 2025-07-23 05:55:36 +02:00
parent
57c7d06bf1
commit
5217ef396e
@ -28,7 +28,8 @@ function asyncTest(testFunc) {
|
||||
}
|
||||
}
|
||||
|
||||
assert.throwsAsync = async function (expectedErrorConstructor, func, message) {
|
||||
assert.throwsAsync = function (expectedErrorConstructor, func, message) {
|
||||
return new Promise(function (resolve) {
|
||||
var innerThenable;
|
||||
if (message === undefined) {
|
||||
message = "";
|
||||
@ -63,7 +64,7 @@ assert.throwsAsync = async function (expectedErrorConstructor, func, message) {
|
||||
}
|
||||
|
||||
try {
|
||||
return innerThenable.then(
|
||||
resolve(innerThenable.then(
|
||||
function () {
|
||||
message +=
|
||||
"Expected a " +
|
||||
@ -91,7 +92,7 @@ assert.throwsAsync = async function (expectedErrorConstructor, func, message) {
|
||||
throw new Test262Error(message);
|
||||
}
|
||||
}
|
||||
);
|
||||
));
|
||||
} catch (thrown) {
|
||||
if (typeof thrown !== "object" || thrown === null) {
|
||||
message +=
|
||||
@ -108,4 +109,5 @@ assert.throwsAsync = async function (expectedErrorConstructor, func, message) {
|
||||
}
|
||||
throw new Test262Error(message);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -9,8 +9,8 @@ flags: [async]
|
||||
includes: [asyncHelpers.js]
|
||||
---*/
|
||||
|
||||
asyncTest(async function() {
|
||||
await assert.throwsAsync(
|
||||
asyncTest(function () {
|
||||
return assert.throwsAsync(
|
||||
Test262Error,
|
||||
function () {
|
||||
Promise.try(function () { throw new Test262Error(); })
|
||||
|
Loading…
x
Reference in New Issue
Block a user