mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-13 18:45:52 +02:00
Merge pull request #20828 from timvandermeij/refactor-reporter
Refactor the custom reporters for testing
This commit is contained in:
commit
654190366f
@ -52,25 +52,29 @@ async function runTests(results) {
|
|||||||
jasmineDone(suiteInfo) {},
|
jasmineDone(suiteInfo) {},
|
||||||
jasmineStarted(suiteInfo) {},
|
jasmineStarted(suiteInfo) {},
|
||||||
specDone(result) {
|
specDone(result) {
|
||||||
// Report on the result of individual tests.
|
// Ignore excluded (fit/xit) or skipped (pending) tests.
|
||||||
if (result.status === "excluded") {
|
if (["excluded", "pending"].includes(result.status)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Report on passed or failed tests.
|
||||||
++results.runs;
|
++results.runs;
|
||||||
if (result.failedExpectations.length > 0) {
|
if (result.status === "passed") {
|
||||||
|
console.log(`TEST-PASSED | ${result.description}`);
|
||||||
|
} else {
|
||||||
++results.failures;
|
++results.failures;
|
||||||
console.log(`TEST-UNEXPECTED-FAIL | ${result.description}`);
|
console.log(`TEST-UNEXPECTED-FAIL | ${result.description}`);
|
||||||
} else {
|
|
||||||
console.log(`TEST-PASSED | ${result.description}`);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
specStarted(result) {},
|
specStarted(result) {},
|
||||||
suiteDone(result) {
|
suiteDone(result) {
|
||||||
if (result.status === "excluded") {
|
// Ignore excluded (fdescribe/xdescribe) or skipped (pending) suites.
|
||||||
|
if (["excluded", "pending"].includes(result.status)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Report on the result of `afterAll` invocations.
|
|
||||||
if (result.failedExpectations.length > 0) {
|
// Report on failed suites only (indicates problems in setup/teardown).
|
||||||
|
if (result.status === "failed") {
|
||||||
++results.failures;
|
++results.failures;
|
||||||
console.log(`TEST-UNEXPECTED-FAIL | ${result.description}`);
|
console.log(`TEST-UNEXPECTED-FAIL | ${result.description}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,11 +62,13 @@ const TestReporter = function (browser) {
|
|||||||
this.specStarted = function (result) {};
|
this.specStarted = function (result) {};
|
||||||
|
|
||||||
this.specDone = function (result) {
|
this.specDone = function (result) {
|
||||||
if (result.status === "excluded") {
|
// Ignore excluded (fit/xit) or skipped (pending) tests.
|
||||||
|
if (["excluded", "pending"].includes(result.status)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Report on the result of individual tests.
|
|
||||||
if (result.failedExpectations.length === 0) {
|
// Report on passed or failed tests.
|
||||||
|
if (result.status === "passed") {
|
||||||
sendResult("TEST-PASSED", result.description);
|
sendResult("TEST-PASSED", result.description);
|
||||||
} else {
|
} else {
|
||||||
let failedMessages = "";
|
let failedMessages = "";
|
||||||
@ -78,11 +80,13 @@ const TestReporter = function (browser) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.suiteDone = function (result) {
|
this.suiteDone = function (result) {
|
||||||
if (result.status === "excluded") {
|
// Ignore excluded (fdescribe/xdescribe) or skipped (pending) suites.
|
||||||
|
if (["excluded", "pending"].includes(result.status)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Report on the result of `afterAll` invocations.
|
|
||||||
if (result.failedExpectations.length > 0) {
|
// Report on failed suites only (indicates problems in setup/teardown).
|
||||||
|
if (result.status === "failed") {
|
||||||
let failedMessages = "";
|
let failedMessages = "";
|
||||||
for (const item of result.failedExpectations) {
|
for (const item of result.failedExpectations) {
|
||||||
failedMessages += `${item.message} `;
|
failedMessages += `${item.message} `;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user