mirror of
https://github.com/tc39/test262.git
synced 2025-07-27 07:54:41 +02:00
harness/asyncHelpers.js: Refactor assert.throwsAsync to fail fast
This commit is contained in:
parent
1b34a1c484
commit
b22b500f24
@ -56,7 +56,11 @@ assert.throwsAsync = function (expectedErrorConstructor, func, message) {
|
|||||||
} else {
|
} else {
|
||||||
message += " ";
|
message += " ";
|
||||||
}
|
}
|
||||||
if (typeof func === "function") {
|
if (typeof func !== "function") {
|
||||||
|
message +=
|
||||||
|
"assert.throwsAsync called with an argument that is not a function";
|
||||||
|
throw new Test262Error(message);
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
innerThenable = func();
|
innerThenable = func();
|
||||||
if (
|
if (
|
||||||
@ -77,11 +81,6 @@ 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);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
message +=
|
|
||||||
"assert.throwsAsync called with an argument that is not a function";
|
|
||||||
throw new Test262Error(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
resolve(innerThenable.then(
|
resolve(innerThenable.then(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user