diff --git a/src/reporter.ts b/src/reporter.ts index 9ddbedf..03756dc 100644 --- a/src/reporter.ts +++ b/src/reporter.ts @@ -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: diff --git a/src/types/@reportportal/client-javascript/lib/helpers.d.ts b/src/types/@reportportal/client-javascript/lib/helpers.d.ts index 351a541..7aaf926 100644 --- a/src/types/@reportportal/client-javascript/lib/helpers.d.ts +++ b/src/types/@reportportal/client-javascript/lib/helpers.d.ts @@ -17,4 +17,5 @@ declare module '@reportportal/client-javascript/lib/helpers' { export function now(): string; + export function formatMicrosecondsToISOString(microseconds: number): string; }