diff --git a/packages/playwright/src/isomorphic/teleReceiver.ts b/packages/playwright/src/isomorphic/teleReceiver.ts index 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; +export type MergeReporterConfig = Pick; 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.ts index 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 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 }'); +});