Skip to content

Commit

Permalink
fix: handle async/await when uploading attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
kobenguyent committed Sep 26, 2024
1 parent 3616a23 commit 3a134b5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,15 +350,15 @@ module.exports = (config) => {
testrail.addResultsForCases(runId, { results: validResults }).then(res => {
output.log(`The run ${runId} is updated with ${JSON.stringify(res)}`);

failedTests.forEach(test => {
testrail.getResultsForCase(runId, test.case_id).then(res => {
for (const test of failedTests) {
testrail.getResultsForCase(runId, test.case_id).then(async res => {
try {
helper && testrail.addAttachmentToResult(res[0].id, attachments[test.case_id]);
helper && await testrail.addAttachmentToResult(res[0].id, attachments[test.case_id]);
} catch (err) {
output.error(`Cannot add attachment due to error: ${err}`)
}
});
});
}
});
_closeTestRun();
}
Expand Down

0 comments on commit 3a134b5

Please sign in to comment.