From 8cae8df17f146a7c928e5bf8f2ad91c120efd356 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 8 Apr 2026 11:43:50 +0100 Subject: [PATCH] Actually skip stale screenshot reporter on errors --- .../src/stale-screenshot-reporter.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/element-web-playwright-common/src/stale-screenshot-reporter.ts b/packages/element-web-playwright-common/src/stale-screenshot-reporter.ts index 39c9a53fa5..2d7b1ec095 100644 --- a/packages/element-web-playwright-common/src/stale-screenshot-reporter.ts +++ b/packages/element-web-playwright-common/src/stale-screenshot-reporter.ts @@ -56,11 +56,7 @@ class StaleScreenshotReporter implements Reporter { this.success = false; } - public async onExit(): Promise { - if (this.failing.size) { - console.error(`${this.failing.size} tests failed, skipping stale screenshot reporter.`); - } - + private async checkStaleScreenshots(): Promise { if (!this.snapshotRoots.size) { this.error("No snapshot directories found, did you set the snapshotDir in your Playwright config?", ""); return; @@ -90,6 +86,14 @@ class StaleScreenshotReporter implements Reporter { this.error("Stale screenshot file", screenshot); } } + } + + public async onExit(): Promise { + if (this.failing.size) { + this.error(`${this.failing.size} tests failed, skipping stale screenshot reporter.`, ""); + } else { + await this.checkStaleScreenshots(); + } if (!this.success) { process.exit(1);