-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
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.3Used Package Manager
pnpm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.