mirror of
https://github.com/tc39/test262.git
synced 2025-05-24 00:30:29 +02:00
harness/asyncHelpers.js: Isolate assert.throwsAsync failure conditions
This commit is contained in:
parent
b22b500f24
commit
0631e2111b
@ -63,17 +63,6 @@ assert.throwsAsync = function (expectedErrorConstructor, func, message) {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
innerThenable = func();
|
innerThenable = func();
|
||||||
if (
|
|
||||||
innerThenable === null ||
|
|
||||||
typeof innerThenable !== "object" ||
|
|
||||||
typeof innerThenable.then !== "function"
|
|
||||||
) {
|
|
||||||
message +=
|
|
||||||
"Expected to obtain an inner promise that would reject with a" +
|
|
||||||
expectedErrorConstructor.name +
|
|
||||||
" but result was not a thenable";
|
|
||||||
throw new Test262Error(message);
|
|
||||||
}
|
|
||||||
} catch (thrown) {
|
} catch (thrown) {
|
||||||
message +=
|
message +=
|
||||||
"Expected a " +
|
"Expected a " +
|
||||||
@ -81,6 +70,17 @@ assert.throwsAsync = function (expectedErrorConstructor, func, message) {
|
|||||||
" to be thrown asynchronously but an exception was thrown synchronously while obtaining the inner promise";
|
" to be thrown asynchronously but an exception was thrown synchronously while obtaining the inner promise";
|
||||||
throw new Test262Error(message);
|
throw new Test262Error(message);
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
innerThenable === null ||
|
||||||
|
typeof innerThenable !== "object" ||
|
||||||
|
typeof innerThenable.then !== "function"
|
||||||
|
) {
|
||||||
|
message +=
|
||||||
|
"Expected to obtain an inner promise that would reject with a" +
|
||||||
|
expectedErrorConstructor.name +
|
||||||
|
" but result was not a thenable";
|
||||||
|
throw new Test262Error(message);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
resolve(innerThenable.then(
|
resolve(innerThenable.then(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user