From d0a2e43ad83338d270a8f2f8dcd9683ca5f6ad65 Mon Sep 17 00:00:00 2001 From: Dmitry Sharapkov <35460045+dsharapkou@users.noreply.github.com> Date: Thu, 26 Sep 2024 09:49:20 +0200 Subject: [PATCH] set close after publishing (#116) --- index.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) 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; };