Skip to content

Commit

Permalink
Add timing information to server CTS runner
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-clayton committed Feb 21, 2024
1 parent cdb6b22 commit 500dfa8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/common/runtime/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ interface RunResult {
status: Status;
// Any additional messages printed
message: string;
// The time it took to execute the test
durationMS: number;
// Code coverage data, if the server was started with `--coverage`
// This data is opaque (implementation defined).
coverageData?: string;
Expand Down Expand Up @@ -202,14 +204,16 @@ if (verbose) {
if (codeCoverage !== undefined) {
codeCoverage.begin();
}
const start = performance.now();
const result = await runTestcase(testcase);
const durationMS = performance.now() - start;
const coverageData = codeCoverage !== undefined ? codeCoverage.end() : undefined;
let message = '';
if (result.logs !== undefined) {
message = result.logs.map(log => prettyPrintLog(log)).join('\n');
}
const status = result.status;
const res: RunResult = { status, message, coverageData };
const res: RunResult = { status, message, durationMS, coverageData };
response.statusCode = 200;
response.end(JSON.stringify(res));
} else {
Expand Down

0 comments on commit 500dfa8

Please sign in to comment.