fix(blob): use reporters from the merge config (#27301)
Fixes https://github.com/microsoft/playwright/issues/27281
This commit is contained in:
parent
07e794eb83
commit
d198784f1a
|
|
@ -32,7 +32,7 @@ export type JsonConfig = Pick<FullConfig, 'configFile' | 'globalTimeout' | 'maxF
|
|||
listOnly: 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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1377,3 +1377,42 @@ function readAllFromStreamAsString(stream: NodeJS.ReadableStream): Promise<strin
|
|||
stream.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 }');
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue