Skip to content

Commit 3a134b5

Browse files
committed
fix: handle async/await when uploading attachments
1 parent 3616a23 commit 3a134b5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,15 +350,15 @@ module.exports = (config) => {
350350
testrail.addResultsForCases(runId, { results: validResults }).then(res => {
351351
output.log(`The run ${runId} is updated with ${JSON.stringify(res)}`);
352352

353-
failedTests.forEach(test => {
354-
testrail.getResultsForCase(runId, test.case_id).then(res => {
353+
for (const test of failedTests) {
354+
testrail.getResultsForCase(runId, test.case_id).then(async res => {
355355
try {
356-
helper && testrail.addAttachmentToResult(res[0].id, attachments[test.case_id]);
356+
helper && await testrail.addAttachmentToResult(res[0].id, attachments[test.case_id]);
357357
} catch (err) {
358358
output.error(`Cannot add attachment due to error: ${err}`)
359359
}
360360
});
361-
});
361+
}
362362
});
363363
_closeTestRun();
364364
}

0 commit comments

Comments
 (0)