diff --git a/keployCli.ts b/keployCli.ts index f804932..e4cd55c 100644 --- a/keployCli.ts +++ b/keployCli.ts @@ -75,6 +75,9 @@ export const Test = async (appCmd: string, runOptions: RunOptions, callback: (er } } + await StopUserApplication(appId); + await UpdateReportWithCoverage(testRunId, testSet) + if (status !== TestRunStatus.PASSED) { result = false; console.error(`Test set: ${testSet} failed with status: ${status}`); @@ -84,7 +87,6 @@ export const Test = async (appCmd: string, runOptions: RunOptions, callback: (er console.log(`Test set: ${testSet} passed`); } testResult = testResult && result; - await StopUserApplication(appId); } } catch (error) { callback(error as Error, false); @@ -134,6 +136,16 @@ const RunTestSet = async (testRunId: string, testSet: string, appId: string): Pr } }; +const UpdateReportWithCoverage = async (testRunId: string, testSet: string): Promise => { + const client = await setHttpClient(); + const response = await client.post('', { + query: `mutation UpdateReportWithCov { updateReportWithCov(testRunId: "${testRunId}", testSetId: "${testSet}", language: "typescript")}` + }); + if (!(response.status >= 200 && response.status < 300 && response.data.data.runTestSet)) { + throw new Error(`Failed to update report with coverage data. Status code: ${response.status}`); + } +}; + const CheckReportFile = async (reportPath: string, timeout: number): Promise => { const startTime = Date.now(); while (Date.now() - startTime < timeout * 1000) {