harness/asyncHelpers.js: Clean up assert.throwsAsync failure messages

* Remove mention of an "inner" promise/thenable.
This commit is contained in:
Richard Gibson 2024-05-19 13:33:08 -04:00
parent b87eaf9ac3
commit 0b61e98564

View File

@ -67,7 +67,7 @@ assert.throwsAsync = function (expectedErrorConstructor, func, message) {
message += message +=
"Expected a " + "Expected a " +
expectedErrorConstructor.name + expectedErrorConstructor.name +
" to be thrown asynchronously but an exception was thrown synchronously while obtaining the inner promise"; " to be thrown asynchronously but the function threw synchronously";
throw new Test262Error(message); throw new Test262Error(message);
} }
if ( if (
@ -76,7 +76,7 @@ assert.throwsAsync = function (expectedErrorConstructor, func, message) {
typeof innerThenable.then !== "function" typeof innerThenable.then !== "function"
) { ) {
message += message +=
"Expected to obtain an inner promise that would reject with a " + "Expected to obtain a promise that would reject with a " +
expectedErrorConstructor.name + expectedErrorConstructor.name +
" but result was not a thenable"; " but result was not a thenable";
throw new Test262Error(message); throw new Test262Error(message);
@ -113,19 +113,10 @@ assert.throwsAsync = function (expectedErrorConstructor, func, message) {
} }
)); ));
} catch (thrown) { } catch (thrown) {
if (typeof thrown !== "object" || thrown === null) { message +=
message += "Expected a " +
"Expected a " + expectedErrorConstructor.name +
expectedErrorConstructor.name + " to be thrown asynchronously but .then threw synchronously";
" to be thrown asynchronously but innerThenable synchronously threw a value that was not an object ";
} else {
message +=
"Expected a " +
expectedErrorConstructor.name +
" to be thrown asynchronously but a " +
thrown.constructor.name +
" was thrown synchronously";
}
throw new Test262Error(message); throw new Test262Error(message);
} }
}); });