Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion keployCli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand All @@ -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);
Expand Down Expand Up @@ -134,6 +136,16 @@ const RunTestSet = async (testRunId: string, testSet: string, appId: string): Pr
}
};

const UpdateReportWithCoverage = async (testRunId: string, testSet: string): Promise<void> => {
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<void> => {
const startTime = Date.now();
while (Date.now() - startTime < timeout * 1000) {
Expand Down