From b154ff11909ffc82f6bc26f79c6619da476a4fa6 Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Wed, 21 Jun 2023 17:53:52 -0700 Subject: [PATCH] fix(html reporter): do not print epilogue in list mode (#23822) References #23817. --- packages/playwright-test/src/common/config.ts | 3 ++- packages/playwright-test/src/reporters/html.ts | 3 ++- packages/playwright-test/src/reporters/teleEmitter.ts | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) 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, }; }