docs: highlight printsToStdio in reporter reference (#19118)

Fixes #18945.
This commit is contained in:
Dmitry Gozman 2022-11-28 10:32:01 -08:00 committed by GitHub
parent e3d7e080b4
commit bd07a63683
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -90,6 +90,8 @@ Here is a typical order of reporter calls:
Additionally, [`method: Reporter.onStdOut`] and [`method: Reporter.onStdErr`] are called when standard output is produced in the worker process, possibly during a test execution,
and [`method: Reporter.onError`] is called when something went wrong outside of the test execution.
If your custom reporter does not print anything to the terminal, implement [`method: Reporter.printsToStdio`] and return `false`. This way, Playwright will use one of the standard terminal reporters in addition to your custom reporter to enhance user experience.
## optional method: Reporter.onBegin
* since: v1.10
@ -273,4 +275,4 @@ Result of the test run.
* since: v1.10
- returns: <[boolean]>
Whether this reporter uses stdio for reporting. When it does not, Playwright Test could add some output to enhance user experience.
Whether this reporter uses stdio for reporting. When it does not, Playwright Test could add some output to enhance user experience. If your reporter does not print to the terminal, it is strongly recommended to return `false`.

View File

@ -367,6 +367,11 @@ export interface FullResult {
* called when standard output is produced in the worker process, possibly during a test execution, and
* [reporter.onError(error)](https://playwright.dev/docs/api/class-reporter#reporter-on-error) is called when
* something went wrong outside of the test execution.
*
* If your custom reporter does not print anything to the terminal, implement
* [reporter.printsToStdio()](https://playwright.dev/docs/api/class-reporter#reporter-prints-to-stdio) and return
* `false`. This way, Playwright will use one of the standard terminal reporters in addition to your custom reporter
* to enhance user experience.
*/
export interface Reporter {
/**
@ -441,7 +446,7 @@ export interface Reporter {
/**
* Whether this reporter uses stdio for reporting. When it does not, Playwright Test could add some output to enhance
* user experience.
* user experience. If your reporter does not print to the terminal, it is strongly recommended to return `false`.
*/
printsToStdio?(): boolean;}