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

Degradation v0.18.0: Terminal no longer reloads on save #1621

Closed
6 tasks done
gkiely opened this issue Jul 9, 2022 · 6 comments
Closed
6 tasks done

Degradation v0.18.0: Terminal no longer reloads on save #1621

gkiely opened this issue Jul 9, 2022 · 6 comments

Comments

@gkiely
Copy link

gkiely commented Jul 9, 2022

Describe the bug

0.17.1: reloads the terminal on save, this is helpful for developer feedback.
0.18.0: doesn't reload the terminal, shows a blue indicator

The original 0.17.1 version had this right, it's a much better dev experience seeing the full reload. The new version is much harder to discern if the test updated.

In the case that the maintainers decide v0.18.0 is the ideal experience, a fallback proposal would be to allow an option to reload on save.

Reproduction

Repo

v0.17.1

npm i
npm test
  • Make any update to App.test.tsx
  • See terminal reload

v0.18.0

npm i vitest@latest
npm test
  • Make any update to App.test.tsx
  • Terminal does not reload, only rerun x2 updates

System Info

System:
    OS: macOS 12.2.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 438.05 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 18.4.0 - ~/.volta/tools/image/node/18.4.0/bin/node
    Yarn: 1.22.18 - ~/.volta/tools/image/yarn/1.22.18/bin/yarn
    npm: 8.12.1 - ~/.volta/tools/image/node/18.4.0/bin/npm
    Watchman: 2022.03.21.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 103.0.5060.114
    Firefox: 101.0.1
    Safari: 15.3
  npmPackages:
    @vitejs/plugin-react: ^1.3.0 => 1.3.2 
    vite: ^2.9.9 => 2.9.14

Used Package Manager

npm

Validations

@gkiely gkiely changed the title Degradation: Terminal no longer reloads on save Degradation v0.18.0: Terminal no longer reloads on save Jul 9, 2022
@gkiely
Copy link
Author

gkiely commented Jul 9, 2022

Related PR: #1166

Related comment:
#1166 (comment)

@gkiely
Copy link
Author

gkiely commented Jul 12, 2022

I can open a PR for a config/cli flag if there's interest.
It would basically behave like jest in that in clears on start and between each run.

@sheremet-va
Copy link
Member

It’s better to discuss first, since the change is intentional.

@FossPrime
Copy link

Whats the best workaround? I'm using vite-node directly. Best workaround I can think of is involves nodemon, but there's gotta be a better way.

@gkiely
Copy link
Author

gkiely commented Jan 4, 2023

@FossPrime This is the plugin I use

vite-plugin-clear-vitest.ts

import pc from 'picocolors';
import type { Plugin } from 'vite';

let hasResolved = false;
const clear = () => {
  process.stdout.write('\x1B[2J\x1B[3J\x1B[H\x1Bc\n');
};

// Clear terminal on initial and subsequent loads for vitest
const plugin = (): Plugin => ({
  name: 'clear-vitest',
  config: () => clear(),
  resolveId: () => ((hasResolved = true), null),
  load: (path) => {
    if (hasResolved && /\.test\.(?:t|j)sx?/.test(path)) {
      clear();
      const pwd = process.env.PWD ? `${process.env.PWD}/` : '';
      console.log(pc.black(pc.bgBlue(' RERUN ')), pc.gray(path.replace(pwd, '')), '\n');
    }
  },
});

export default plugin;

vitest.config.ts

import { defineConfig } from 'vitest/config';
import clearVitest from './vite-plugin-clear-vitest';

export default defineConfig({
  plugins: [
    clearVitest(),
  ],
});

@sheremet-va
Copy link
Member

The team likes how the terminal behaves at the moment.

@sheremet-va sheremet-va closed this as not planned Won't fix, can't repro, duplicate, stale Feb 16, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants