vitest
vitest copied to clipboard
Screen not clearing when `clearScreen: true`
Describe the bug
Might be related to #1125. I have the option clearScreen: true
but when in watch mode, the screen is not clearing when the files change.
I have the configuration split in the following way:
// vite.config.ts
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
// A bunch of paths
},
},
build: {
sourcemap: true,
manifest: true,
},
clearScreen: true,
});
// vitest.config.ts
import { mergeConfig } from "vite";
import { defineConfig } from "vitest/config";
import viteConfig from "./vite.config";
export default mergeConfig(
viteConfig,
defineConfig({
test: {
globals: true,
environment: "jsdom",
setupFiles: ["./src/reduxSetup.ts", "./src/setup.ts"],
cache: false,
sequence: {
shuffle: false,
},
},
clearScreen: true,
})
);
Reproduction
Change the test in the StackBlitz to see the terminal not being cleared up
System Info
System:
OS: Linux 5.10 Ubuntu 20.04.4 LTS (Focal Fossa)
CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
Memory: 12.30 GB / 15.60 GB
Container: Yes
Shell: 5.8 - /usr/bin/zsh
Binaries:
Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v16.16.0/bin/yarn
npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
npmPackages:
@vitejs/plugin-react: ^2.0.1 => 2.0.1
vite: ^3.0.9 => 3.0.9
vitest: ^0.22.1 => 0.22.1
Used Package Manager
yarn
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.
In source code, clearScreen
real effect is to clear rerun
test suits result, not clear all the stdout characters in the terminal. It seems like conflict with vite. @sheremet-va

I think this may be fixed since https://github.com/vitest-dev/vitest/pull/2228. cc: @sheremet-va