Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Console does not clear after test when using --watch #15051

Open
NicholasJohn16 opened this issue May 3, 2024 · 1 comment
Open

[Bug]: Console does not clear after test when using --watch #15051

NicholasJohn16 opened this issue May 3, 2024 · 1 comment

Comments

@NicholasJohn16
Copy link

Version

29.7.0

Steps to reproduce

Run tests in watch mode on Windows 11 PC with Powershell or other terminal.

Expected behavior

The console should clear between re-runs when using --watch.

Actual behavior

The console does not clear between re-runs.

Additional context

I've attempted to get this to work on Command Prompt, Powershell v5.1, and Powershell v7.4, and it won't clear output. This appears to be related to #5251. If I change the CLEAR constant back to it's previous value for Windows the screen clears as it should.

Environment

System:
  OS: Windows 11
  CPU (8) Intel
Binaries:
  Node: 18.17.0
  npm: 9.6.7
npmPackages:
  jest: 29.7.0
@mrazauskas
Copy link
Contributor

Interesting. The change you are pointing to is six years old. Hard to believe nobody complained for so long.

For fun, I installed Powershell 7.4.2 on macOS via Homebrew. Both of the following patterns work as expected (I removed the isWindows check for testing):

export const CLEAR = isWindows
? '\u001B[2J\u001B[0f'
: '\u001B[2J\u001B[3J\u001B[H';

Hard to say why isWindows check was needed here. I doubt, if, for example, VS Code terminal has different implementation for Windows and macOS.

Note that \x1Bc is very likely interpreted as reset, not clear. There is no single specification, but many implementations are pointing to VT100: https://vt100.net/docs/vt510-rm/RIS.html.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants