diff --git a/index.js b/index.js index 1da6d5c..51bdcde 100644 --- a/index.js +++ b/index.js @@ -187,10 +187,14 @@ module.exports = (config) => { } await _publishResultsToTestrail(); + await _closeTestRun(); }); event.dispatcher.on(event.all.result, async () => { - if (!process.env.RUNS_WITH_WORKERS) await _publishResultsToTestrail(); + if (!process.env.RUNS_WITH_WORKERS) { + await _publishResultsToTestrail(); + await _closeTestRun(); + } }); async function _publishResultsToTestrail() { @@ -357,12 +361,6 @@ module.exports = (config) => { } }); }); - - if (config.closeTestRun === true) { - testrail.closeTestRun(runId).then(res => { - output.log(`The run ${runId} is updated with ${JSON.stringify(res)}`); - }); - } }); } }); @@ -371,6 +369,14 @@ module.exports = (config) => { } } + async function _closeTestRun() { + if (config.closeTestRun === true) { + testrail.closeTestRun(runId).then(res => { + output.log(`The run ${runId} is updated with ${JSON.stringify(res)}`); + }); + } + } + return this; };