Skip to content

EPMRPP-67784 & EPMRPP-106324 || Ensure test status reflects failed testAssertion and skipped assertions #118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions lib/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/
const errorHandler = (err) => {
if (err) {
console.error(err);

Check warning on line 34 in lib/reporter.js

View workflow job for this annotation

GitHub Actions / test

Unexpected console statement
}
};

Expand Down Expand Up @@ -322,16 +322,15 @@

const additionalData = {};

if (testAssertion.skipped) {
additionalData.status = TestStatus.SKIPPED;
if (this.options.skippedIssue === false) {
additionalData.issue = { issueType: 'NOT_ISSUE' };
}
const status = currentStep.status || (testAssertion.skipped ? TestStatus.SKIPPED : (actualError ? TestStatus.FAILED : TestStatus.PASSED));

Check failure on line 325 in lib/reporter.js

View workflow job for this annotation

GitHub Actions / test

Do not nest ternary expressions

Check failure on line 325 in lib/reporter.js

View workflow job for this annotation

GitHub Actions / test

Replace `·currentStep.status·||·(testAssertion.skipped·?·TestStatus.SKIPPED·:·(actualError·?·TestStatus.FAILED·:·TestStatus.PASSED)` with `⏎······currentStep.status·||⏎······(testAssertion.skipped⏎········?·TestStatus.SKIPPED⏎········:·actualError⏎··········?·TestStatus.FAILED⏎··········:·TestStatus.PASSED`

if (testAssertion.skipped && this.options.skippedIssue === false) {
additionalData.issue = { issueType: 'NOT_ISSUE' };
}

this.client
.finishTestItem(stepObj.tempId, {
status: currentStep.status || (actualError ? TestStatus.FAILED : TestStatus.PASSED),
status,
...additionalData,
})
.promise.catch(errorHandler);
Expand Down Expand Up @@ -408,9 +407,11 @@
this.sendResponseLogs(testObj.testId, testObj.response);
}

const hasFailedAssertions = result.assertions && result.assertions.some(assertion => assertion.error);

Check failure on line 410 in lib/reporter.js

View workflow job for this annotation

GitHub Actions / test

Expected parentheses around arrow function argument

Check failure on line 410 in lib/reporter.js

View workflow job for this annotation

GitHub Actions / test

Replace `·result.assertions·&&·result.assertions.some(assertion` with `⏎······result.assertions·&&·result.assertions.some((assertion)`

this.client
.finishTestItem(testObj.testId, {
status: status || TestStatus.PASSED,
status: status || (hasFailedAssertions ? TestStatus.FAILED : TestStatus.PASSED),
})
.promise.catch(errorHandler);
}
Expand Down Expand Up @@ -469,7 +470,7 @@
* @param {string} [level="INFO"] Log level.
* @param {number} time when the log was started.
*/
logMessage(id, value, level = 'INFO', time) {

Check warning on line 473 in lib/reporter.js

View workflow job for this annotation

GitHub Actions / test

Default parameters should be last
this.client
.sendLog(id, {
level,
Expand Down
Loading