Skip to content

Commit

Permalink
feat: add function to send graphql request to update testset report
Browse files Browse the repository at this point in the history
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
  • Loading branch information
AkashKumar7902 committed Apr 7, 2024
1 parent abd393d commit 8c9fbe9
Showing 1 changed file with 13 additions and 1 deletion.
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

0 comments on commit 8c9fbe9

Please sign in to comment.