mirror of https://github.com/tc39/test262.git
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 {
|
||||
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) {
|
||||
message +=
|
||||
"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";
|
||||
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 {
|
||||
resolve(innerThenable.then(
|
||||
|
|
Loading…
Reference in New Issue