fix(html-report): fix command to open HTML report (#10231)

This commit is contained in:
Andrey Lushnikov 2021-11-12 00:12:23 -08:00 committed by GitHub
parent 80da0f7b69
commit bd1ce399e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -144,10 +144,11 @@ class HtmlReporter implements Reporter {
if (shouldOpen) {
await showHTMLReport(reportFolder, singleTestId);
} else {
const outputFolderPath = htmlReportFolder(this._outputFolder) === defaultReportFolder() ? '' : ' ' + path.relative(process.cwd(), htmlReportFolder(this._outputFolder));
console.log('');
console.log('To open last HTML report run:');
console.log(colors.cyan(`
npx playwright show-report
npx playwright show-report${outputFolderPath}
`));
}
}
@ -158,6 +159,10 @@ export function htmlReportFolder(outputFolder?: string): string {
return path.resolve(process.cwd(), process.env[`PLAYWRIGHT_HTML_REPORT`]);
if (outputFolder)
return outputFolder;
return defaultReportFolder();
}
function defaultReportFolder(): string {
return path.resolve(process.cwd(), 'playwright-report');
}