Skip to content

Commit

Permalink
chore: test framework better error reporting with file name and messa…
Browse files Browse the repository at this point in the history
…ge when available
  • Loading branch information
abose committed Oct 6, 2023
1 parent 110ea3f commit 3bb7646
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions test/UnitTestReporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,15 @@ define(function (require, exports, module) {
window.externalJasmineFailures = true;
testRunnerErrorToConsole(`\u2716 Some suites was detected to have failures outside of the suite tests. This could indicate an underlying problem. please run tests locally to debug.`);
for(const element of result.failedExpectations) {
let message = element.message;
if(element.filename) {
message = `In ${element.filename} \n${message}`;
}
if(element.stack){
testRunnerErrorToConsole(`\u2716 Runner Error: Failure: `, element.message,
testRunnerErrorToConsole(`\u2716 Runner Error: Failure: `, message,
'\nStack: ', element.stack);
} else {
testRunnerErrorToConsole(`\u2716 Runner Error: Failure: `, element.message);
testRunnerErrorToConsole(`\u2716 Runner Error: Failure: `, message);
}
}
quitIfNeeded(1);
Expand Down Expand Up @@ -502,11 +506,15 @@ define(function (require, exports, module) {
testRunnerErrorToConsole(`\u2716 'Test suite run failed!! with status: ` + runner.overallStatus);

for(const element of runner.failedExpectations) {
let message = element.message;
if(element.filename) {
message = `In ${element.filename} \n${message}`;
}
if(element.stack){
testRunnerErrorToConsole(`\u2716 Runner Error: Failure: `, element.message,
testRunnerErrorToConsole(`\u2716 Runner Error: Failure: `, message,
'\nStack: ', element.stack);
} else {
testRunnerErrorToConsole(`\u2716 Runner Error: Failure: `, element.message);
testRunnerErrorToConsole(`\u2716 Runner Error: Failure: `, message);
}
}
}
Expand All @@ -521,11 +529,15 @@ define(function (require, exports, module) {
testRunnerErrorToConsole(`\u2716 Suite failed!!`, suiteResult.description + ' was ' + suiteResult.status);

for(const element of suiteResult.failedExpectations) {
let message = element.message;
if(element.filename) {
message = `In ${element.filename} \n${message}`;
}
if(element.stack){
testRunnerErrorToConsole(`\u2716 Suite Error: Failure: `, element.message,
testRunnerErrorToConsole(`\u2716 Suite Error: Failure: `, message,
'\nStack: ', element.stack);
} else {
testRunnerErrorToConsole(`\u2716 Suite Error: Failure: `, element.message);
testRunnerErrorToConsole(`\u2716 Suite Error: Failure: `, message);
}
}

Expand Down Expand Up @@ -553,11 +565,15 @@ define(function (require, exports, module) {
testRunnerErrorToConsole(`\u2716 Spec failed!!`, spec.description + ' was ' + spec.status);

for(const element of spec.failedExpectations) {
let message = element.message;
if(element.filename) {
message = `In ${element.filename} \n${message}`;
}
if(element.stack){
testRunnerErrorToConsole(`\u2716 Spec Error: Failure: `, element.message,
testRunnerErrorToConsole(`\u2716 Spec Error: Failure: `, message,
'\nStack: ', element.stack);
} else {
testRunnerErrorToConsole(`\u2716 Spec Error: Failure: `, element.message);
testRunnerErrorToConsole(`\u2716 Spec Error: Failure: `, message);
}
}
}
Expand Down

0 comments on commit 3bb7646

Please sign in to comment.