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

iTerm2 clear screen does not clear the screen properly #5977

Closed
6 tasks done
kxalex opened this issue Jun 26, 2024 · 5 comments · Fixed by #5978
Closed
6 tasks done

iTerm2 clear screen does not clear the screen properly #5977

kxalex opened this issue Jun 26, 2024 · 5 comments · Fixed by #5978
Labels
p2-edge-case Bug, but has workaround or limited in scope (priority)

Comments

@kxalex
Copy link
Contributor

kxalex commented Jun 26, 2024

Describe the bug

iTerm2 does not clear the screen properly when vitest is running in watch mode.

Reproduction

Use iTerm2 under Mac.

Run vitest on any project and on re-run not whole screen was cleared, there are some leftovers from previous run.

vitest currently uses to clear the screen and erase scrollback.

this.console.log(`${CLEAR_SCREEN}${ERASE_SCROLLBACK}${message}`)

iTerm2 reacts properly on that sequence, although clear screen sequence leaves 1 page visible and erase scrollback removes the history leaving this not-cleared page.

By flipping the sequence iTerm2 behaves properly.

this.console.log(`${ERASE_SCROLLBACK}${CLEAR_SCREEN}${message}`)

I've added changes in this PR against 1.6.0 version. Although I'm still using 1.5.3 due to cloudflare limitations.

https://github.com/vitest-dev/vitest/pull/5978/files

The erase scrollback and clear screen can be tested in shell using

printf '\e[3J' && printf '\x1Bc' # does not clear all screen
printf '\x1Bc' && printf '\e[3J' # clears everything

This was also tested on default macos terminal and it works fine too.

System Info

System:
    OS: macOS 14.5
    CPU: (10) arm64 Apple M2 Pro
    Memory: 65.22 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.2.0 - /opt/homebrew/bin/node
    npm: 10.7.0 - /opt/homebrew/bin/npm
    pnpm: 9.4.0 - /opt/homebrew/bin/pnpm
  Browsers:
    Brave Browser: 125.1.66.118
    Chrome: 126.0.6478.116
    Safari: 17.5
  npmPackages:
    @vitest/monorepo:  1.5.3

Used Package Manager

pnpm

Validations

@AriPerkkio
Copy link
Member

This issue also came up during #1183 (comment) and it also happens on Jest #3661 (comment).

Copy link

Hello @kxalex. Please provide a minimal reproduction using a GitHub repository or StackBlitz (you can also use examples). Issues marked with needs reproduction will be closed if they have no activity within 3 days.

@AriPerkkio
Copy link
Member

I'm unable to reproduce this issue anymore at all. Please include a minimal test case that could be used to reproduce this issue.

@kxalex
Copy link
Contributor Author

kxalex commented Jun 29, 2024

@AriPerkkio

iTerm 3.5.2
Repo: https://github.com/kxalex/young-hill-9b37

cloudflare supports 1.5.3 for now, but you can change to 1.6.0 and will get the same result.

Also adding demo video where the half of the screen is not-cleared because those values needs to be flipped.

Screen.Recording.2024-06-29.at.7.28.55.PM.mp4

@AriPerkkio AriPerkkio added p2-edge-case Bug, but has workaround or limited in scope (priority) and removed needs reproduction pending triage labels Jun 29, 2024
@AriPerkkio
Copy link
Member

Thanks for the setup, I can reproduce the issue now.

Also worth to note that this issue seems to only come up in iTerm2. Mac's default Terminal and VSCode's terminal seem to work just fine.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p2-edge-case Bug, but has workaround or limited in scope (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants