Skip to content

Commit

Permalink
EPMRPP-94905 || Fix endTime calculation for tests with known duration
Browse files Browse the repository at this point in the history
  • Loading branch information
AmsterGet committed Sep 23, 2024
1 parent ca79a97 commit d647e7d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,11 @@ export class RPReporter implements Reporter {
case TASK_STATUS.fail:
finishTestItemObj.status = state === TASK_STATUS.fail ? STATUSES.FAILED : STATUSES.PASSED;
if (startTime && duration) {
finishTestItemObj.endTime = startTime + duration;
// duration can be a floating number with more than 3 digits after dot
const fixedDurationInMs = Number(duration.toFixed(3));
finishTestItemObj.endTime = clientHelpers.formatMicrosecondsToISOString(
(startTime + fixedDurationInMs) * 1000,
);
}
break;
case TASK_MODE.skip:
Expand Down
1 change: 1 addition & 0 deletions src/types/@reportportal/client-javascript/lib/helpers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@

declare module '@reportportal/client-javascript/lib/helpers' {
export function now(): string;
export function formatMicrosecondsToISOString(microseconds: number): string;
}

0 comments on commit d647e7d

Please sign in to comment.