Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix(blob): use reporters from the merge config (#27301)
Yury Semikhatskyd198784f1a62
diff --git a/packages/playwright/src/isomorphic/teleReceiver.ts b/packages/playwright/src/isomorphic/teleReceiver.tsindex 6de7a3f76a..b78006cae9 100644--- a/packages/playwright/src/isomorphic/teleReceiver.ts+++ b/packages/playwright/src/isomorphic/teleReceiver.ts@@ -32,7 +32,7 @@ export type JsonConfig = Pick<FullConfig, 'configFile' | 'globalTimeout' | 'maxFlistOnly: boolean;};-export type MergeReporterConfig = Pick<FullConfig, 'configFile' | 'quiet' | 'reportSlowTests' | 'rootDir' >;+export type MergeReporterConfig = Pick<FullConfig, 'configFile' | 'quiet' | 'reportSlowTests' | 'rootDir' | 'reporter' >;export type JsonPattern = {s?: string;@@ -327,6 +327,7 @@ export class TeleReporterReceiver {result.rootDir = this._reportConfig.rootDir;result.reportSlowTests = this._reportConfig.reportSlowTests;result.quiet = this._reportConfig.quiet;+ result.reporter = [...this._reportConfig.reporter];}return result;}diff --git a/tests/playwright-test/reporter-blob.spec.ts b/tests/playwright-test/reporter-blob.spec.tsindex ef633c8838..4f273be2d3 100644--- a/tests/playwright-test/reporter-blob.spec.ts+++ b/tests/playwright-test/reporter-blob.spec.ts@@ -1377,3 +1377,42 @@ function readAllFromStreamAsString(stream: NodeJS.ReadableStream): Promise<strinstream.on('end', () => resolve(Buffer.concat(chunks).toString('utf8')));});}++test('reporter list in the custom config', async ({ runInlineTest, mergeReports }) => {+ test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/27281' });+ const reportDir = test.info().outputPath('blob-report');+ const files = {+ 'playwright.config.ts': `+ module.exports = { reporter: 'blob' };+ `,+ 'a.test.ts': `+ import { test, expect } from '@playwright/test';++ test('first', async ({}) => {+ });+ `,+ 'merged/testReporter.js': `+ class TestReporter {+ onBegin(fullConfig, suite) {+ console.log('reporter', fullConfig.reporter);+ }+ }++ module.exports = TestReporter;+ `,+ 'merged/playwright.config.ts': `+ module.exports = {+ retries: 1,+ reporter: [['./testReporter.js', { myOpt: 1 }]]+ };+ `,+ };+ await runInlineTest(files);++ const { exitCode, output } = await mergeReports(reportDir, undefined, { additionalArgs: ['--config', test.info().outputPath('merged/playwright.config.ts')] });+ expect(exitCode).toBe(0);++ const text = stripAnsi(output);+ expect(text).toContain('testReporter.js');+ expect(text).toContain('{ myOpt: 1 }');+});