From 16f634649f21af2c836e8d5d30e402f40b764185 Mon Sep 17 00:00:00 2001 From: Adam Gastineau Date: Tue, 1 Apr 2025 05:28:30 -0700 Subject: [PATCH] fix(reporter): remove stale annotations from JsonTestEnd (#35426) --- packages/playwright/src/isomorphic/teleReceiver.ts | 7 +++++-- packages/playwright/src/reporters/teleEmitter.ts | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/playwright/src/isomorphic/teleReceiver.ts b/packages/playwright/src/isomorphic/teleReceiver.ts index 4504c160fd..39a3461d8a 100644 --- a/packages/playwright/src/isomorphic/teleReceiver.ts +++ b/packages/playwright/src/isomorphic/teleReceiver.ts @@ -75,7 +75,8 @@ export type JsonTestEnd = { testId: string; expectedStatus: reporterTypes.TestStatus; timeout: number; - annotations: Annotation[]; + // Dropped in 1.52. Kept as empty array for backwards compatibility. + annotations: []; }; export type JsonTestResultStart = { @@ -235,7 +236,9 @@ export class TeleReporterReceiver { const test = this._tests.get(testEndPayload.testId)!; test.timeout = testEndPayload.timeout; test.expectedStatus = testEndPayload.expectedStatus; - test.annotations = testEndPayload.annotations; + // Should be empty array, but if it's not, it represents all annotations for that test + if (testEndPayload.annotations.length > 0) + test.annotations = testEndPayload.annotations; const result = test.results.find(r => r._id === payload.id)!; result.duration = payload.duration; result.status = payload.status; diff --git a/packages/playwright/src/reporters/teleEmitter.ts b/packages/playwright/src/reporters/teleEmitter.ts index 45532683cf..1e51dff309 100644 --- a/packages/playwright/src/reporters/teleEmitter.ts +++ b/packages/playwright/src/reporters/teleEmitter.ts @@ -73,8 +73,8 @@ export class TeleReporterEmitter implements ReporterV2 { const testEnd: teleReceiver.JsonTestEnd = { testId: test.id, expectedStatus: test.expectedStatus, - annotations: test.annotations, timeout: test.timeout, + annotations: [] }; this._messageSink({ method: 'onTestEnd',