chore: allow setting reporter via env (#11848)

This commit is contained in:
Pavel Feldman 2022-02-03 16:10:39 -08:00 committed by GitHub
parent d237ad76c1
commit 72424dc904
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -125,7 +125,7 @@ class HtmlReporter implements Reporter {
constructor(options: { outputFolder?: string, open?: 'always' | 'never' | 'on-failure' } = {}) { constructor(options: { outputFolder?: string, open?: 'always' | 'never' | 'on-failure' } = {}) {
// TODO: resolve relative to config. // TODO: resolve relative to config.
this._outputFolder = options.outputFolder; this._outputFolder = options.outputFolder;
this._open = options.open || 'on-failure'; this._open = process.env.PW_TEST_HTML_REPORT_OPEN as any || options.open || 'on-failure';
} }
printsToStdio() { printsToStdio() {

View file

@ -113,6 +113,11 @@ export class Runner {
reporters.push(new reporterConstructor(arg)); reporters.push(new reporterConstructor(arg));
} }
} }
if (process.env.PW_TEST_REPORTER) {
const reporterConstructor = await this._loader.loadReporter(process.env.PW_TEST_REPORTER);
reporters.push(new reporterConstructor());
}
const someReporterPrintsToStdio = reporters.some(r => { const someReporterPrintsToStdio = reporters.some(r => {
const prints = r.printsToStdio ? r.printsToStdio() : true; const prints = r.printsToStdio ? r.printsToStdio() : true;
return prints; return prints;