Use the status property of Jasmine's result object in the custom reporters

This improves readability of the code and makes it consistent with the
recently added check for excluded tests.
This commit is contained in:
Tim van der Meij 2026-03-08 12:41:13 +01:00
parent 9c21d7016b
commit 8a5f6f5157
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762
2 changed files with 4 additions and 4 deletions

View File

@ -57,7 +57,7 @@ async function runTests(results) {
return;
}
++results.runs;
if (result.failedExpectations.length === 0) {
if (result.status === "passed") {
console.log(`TEST-PASSED | ${result.description}`);
} else {
++results.failures;
@ -70,7 +70,7 @@ async function runTests(results) {
return;
}
// Report on the result of `afterAll` invocations.
if (result.failedExpectations.length > 0) {
if (result.status === "failed") {
++results.failures;
console.log(`TEST-UNEXPECTED-FAIL | ${result.description}`);
}

View File

@ -66,7 +66,7 @@ const TestReporter = function (browser) {
return;
}
// Report on the result of individual tests.
if (result.failedExpectations.length === 0) {
if (result.status === "passed") {
sendResult("TEST-PASSED", result.description);
} else {
let failedMessages = "";
@ -82,7 +82,7 @@ const TestReporter = function (browser) {
return;
}
// Report on the result of `afterAll` invocations.
if (result.failedExpectations.length > 0) {
if (result.status === "failed") {
let failedMessages = "";
for (const item of result.failedExpectations) {
failedMessages += `${item.message} `;