vitest icon indicating copy to clipboard operation
vitest copied to clipboard

Screen not clearing when `clearScreen: true`

Open YolCruz opened this issue 2 years ago • 1 comments

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

YolCruz avatar Aug 27 '22 01:08 YolCruz

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

image

sun0day avatar Aug 30 '22 03:08 sun0day

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

silverwind avatar Nov 02 '22 10:11 silverwind