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

Clear Terminal Screen When Running In Watch Mode #1623

Closed
ghost opened this issue Dec 31, 2017 · 6 comments
Closed

Clear Terminal Screen When Running In Watch Mode #1623

ghost opened this issue Dec 31, 2017 · 6 comments

Comments

@ghost
Copy link

ghost commented Dec 31, 2017

FEATURE

It would be nice to clear terminal screen while running in watch mode.

A Simple package like clear could be used.

WHY ?

It becomes very disturbing when running tests in watch mode and the terminal gets filled very quickly,
So you have to clear it manually.

@novemberborn
Copy link
Member

The previous run is left visible since you may need to refer back to it while you're debugging test failures. Admittedly the larger the test suite the more confusing this gets. We do try to print a separator so you know where the previous run ended.

Most terminals have a shortcut for clearing the screen. I often use this, followed by typing r + Enter which reruns the tests for you.

We're open for suggestions on how to improve the separation between the test runs. Or perhaps we should have a "clear and rerun tests" command?

@ghost
Copy link
Author

ghost commented Jan 3, 2018

@novemberborn , Is there a way to run only the changed tests in watch mode so that all tests are not run again ?

This could make it comfortable on the console.

@novemberborn
Copy link
Member

@clemtrek watch mode does that automatically when you modify files.

@ghost
Copy link
Author

ghost commented Jan 3, 2018

Thanks

@capttrousers
Copy link

capttrousers commented Nov 27, 2021

Can we reopen this as a feature request? I'd like to have an opt in config to clear the screen between reruns in watch mode.

I took a look through the code, and could try a PR but I'm not quite clear on where this kind of behavior would go.

Nodemon has an "events" hook option where you can declare aribtrary terminal commands to run on events like start or restart, so I have this in my nodemon config:

    "events": {
      "start": "npm run clean && clear"
    }

The clean npm script cleans up some temp data like logs, so that'd be nice to get a similar start or rerun hook option for ava's watch mode, so I could run those clean and clear commands when running tests too.

@novemberborn
Copy link
Member

@capttrousers I think the right approach is to improve the reporters, see #2500.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants