Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix(html reporter): do not print epilogue in list mode (#23822)

Dmitry Gozmanb154ff11909f
diff --git a/packages/playwright-test/src/common/config.ts b/packages/playwright-test/src/common/config.ts
index ff61f2ac51..754e276bc6 100644
--- a/packages/playwright-test/src/common/config.ts
+++ b/packages/playwright-test/src/common/config.ts
@@ -53,7 +53,8 @@ export class FullConfigInternal {
testIdMatcher?: Matcher;
defineConfigWasUsed = false;
- static from(config: FullConfig): FullConfigInternal {
+ // TODO: when merging reports, there could be no internal config. This is very unfortunate.
+ static from(config: FullConfig): FullConfigInternal | undefined {
return (config as any)[configInternalSymbol];
}
diff --git a/packages/playwright-test/src/reporters/html.ts b/packages/playwright-test/src/reporters/html.ts
index 0a15a4e40f..091da19fb3 100644
--- a/packages/playwright-test/src/reporters/html.ts
+++ b/packages/playwright-test/src/reporters/html.ts
@@ -30,6 +30,7 @@ import type { ZipFile } from 'playwright-core/lib/zipBundle';
import { yazl } from 'playwright-core/lib/zipBundle';
import { mime } from 'playwright-core/lib/utilsBundle';
import type { HTMLReport, Stats, TestAttachment, TestCase, TestCaseSummary, TestFile, TestFileSummary, TestResult, TestStep } from '@html-reporter/types';
+import { FullConfigInternal } from '../common/config';
type TestEntry = {
testCase: TestCase;
@@ -119,7 +120,7 @@ class HtmlReporter implements Reporter {
const shouldOpen = this._open === 'always' || (!ok && this._open === 'on-failure');
if (shouldOpen) {
await showHTMLReport(this._outputFolder, this._options.host, this._options.port, singleTestId);
- } else {
+ } else if (!FullConfigInternal.from(this.config)?.cliListOnly) {
const relativeReportPath = this._outputFolder === standaloneDefaultFolder() ? '' : ' ' + path.relative(process.cwd(), this._outputFolder);
console.log('');
console.log('To open last HTML report run:');
diff --git a/packages/playwright-test/src/reporters/teleEmitter.ts b/packages/playwright-test/src/reporters/teleEmitter.ts
index bfcfb01c24..338c340cd5 100644
--- a/packages/playwright-test/src/reporters/teleEmitter.ts
+++ b/packages/playwright-test/src/reporters/teleEmitter.ts
@@ -129,8 +129,7 @@ export class TeleReporterEmitter implements Reporter {
rootDir: config.rootDir,
version: config.version,
workers: config.workers,
-
- listOnly: FullConfigInternal.from(config)?.cliListOnly,
+ listOnly: !!FullConfigInternal.from(config)?.cliListOnly,
};
}