From 6c3d35fa5825c5c2f1ff4b5e30b9a8cc3f6fc943 Mon Sep 17 00:00:00 2001 From: Leo Sklyut Date: Mon, 27 Feb 2023 05:04:22 -0500 Subject: [PATCH] fix(junit): use the JUnit schema's specified ISO format for timestamp (#21062) Signed-off-by: Max Schmitt Co-authored-by: Max Schmitt --- packages/playwright-test/src/reporters/junit.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/playwright-test/src/reporters/junit.ts b/packages/playwright-test/src/reporters/junit.ts index 2594f666f8..1e5cf6df4a 100644 --- a/packages/playwright-test/src/reporters/junit.ts +++ b/packages/playwright-test/src/reporters/junit.ts @@ -24,7 +24,7 @@ import { assert } from 'playwright-core/lib/utils'; class JUnitReporter implements Reporter { private config!: FullConfig; private suite!: Suite; - private timestamp!: number; + private timestamp!: Date; private startTime!: number; private totalTests = 0; private totalFailures = 0; @@ -51,7 +51,7 @@ class JUnitReporter implements Reporter { onBegin(config: FullConfig, suite: Suite) { this.config = config; this.suite = suite; - this.timestamp = Date.now(); + this.timestamp = new Date(); this.startTime = monotonicTime(); } @@ -116,7 +116,7 @@ class JUnitReporter implements Reporter { name: 'testsuite', attributes: { name: suite.title, - timestamp: this.timestamp, + timestamp: this.timestamp.toISOString(), hostname: projectName, tests, failures,