[Feature]: Mechanism to disable TTY behaviour in reporters
🚀 Feature Request
Currently there is no way to force reporters to use their non-TTY output.
I would like a way to tell playwright reporters to produce non-TTY output - without ansi escapes and cursor manipulation, even when process.stdout.isTTY reports true.
Currently isTTY in the base reporter is set based on the value of process.stdout.isTTY, and you can use process.env.PWTEST_TTY_WIDTH to force TTY behaviour to be on, but there is no way to force it to be off.
Example
The least invasive way could be to add a new environment variable FORCE_TTY (name up for grabs) that acts as a boolean and if it is set isTTY in the base reporter uses the value from that.
Then FORCE_TTY=0 npm run playwright test would output content without ansi codes.
This feels similar to FORCE_COLOR as a mechanism of forcing color output that is used just below where isTTY is defined.
Alternatively reporters could have an option that toggles TTY/color usage, but it doesn't look like playwright currently has a concept of options on the base reporter and I'm not sure if you'd want to add one. It feels like introducing that might be a breaking change as reporters that extend from the base would need to start ensuring those base options are passed through.
Motivation
I want to run the list reporter on CI to give improved visibility on "what test runs on what test shard". I'm using Buildkite as a CI provider, which runs CI scripts in a pseudo-TTY (and thus process.stdout.isTTY returns true) and transforms ansi escapes into HTML, however it seems to have a rendering bug where it mangles the line rewriting using cursor controls that the list reporter uses in a TTY. https://github.com/buildkite/terminal-to-html/issues/127 is the bug raised against buildkite, which contains examples of how buildkite mangles output.
I'd like a way to force the list reporter to output plain text without cursor controls, to avoid this bug.