Adds '--clear-screen' option to clear screen between watch runs#3355
Adds '--clear-screen' option to clear screen between watch runs#3355colinta wants to merge 1 commit intoavajs:mainfrom
Conversation
3f24214 to
4674c0d
Compare
|
Correction: it works fine using |
|
I have no opinion whether this should be added, but the flag should be |
|
I'm not personally a fan of the more verbose I gave this a short alias of |
novemberborn
left a comment
There was a problem hiding this comment.
Yea I don't mind this. Our long-form flags are not abbreviated so 👍 on --clear-screen.
Do we want to keep this as a CLI flag only or also support it in the configuration?
Testing wise, this could be a permutation of
ava/test-tap/reporters/default.js
Line 45 in 024de32
| startRun(plan) { | ||
| if (this.clearScreen) { | ||
| this.lineWriter.write(ansiEscapes.clearTerminal); | ||
| } |
There was a problem hiding this comment.
Maybe move this down into the if (this.watching && !plan.firstRun) line below? It better connects clearScreen with watch mode plus maybe there's no need to clean the terminal on the first run? Or does that get weird?
There was a problem hiding this comment.
I had it somewhere down there to start, but then it occurred to me that --clear-screen without --watch had no effect at all, which simply felt "unhandled". Why not have it clear the screen? 🤔
Since then I've been actually using it without the watch flag just as often as with it.
|
Thanks for the pointers, I'll try to get those tests updated, and yes having it config makes sense 👍 |
|
Closing due to inactivity. We'd be happy to pick this up again when you have the time to get back to this. |
This is very slapped together, but I wanted it for myself and figured I'd start the conversation. If you are even open to mergin it let me know of any changes.
Usage:
What does this PR change?
Between test runs, it sends
this.lineWriter.write(ansiEscapes.clearTerminal), which clears the screen and scrollback buffer on all the terminal apps I have handy.I promoted this same behaviour in TypeScript, I guess it's my hill to die on 🤣 (in that case,
--watchwas already clearing the screen, this just changed/improved the behaviour).Jest also clears the screen when using
--watch. I prefer it, FWIW, but I've read the argument for keeping all those logs... I'm not convinced, but hey that's just me. I'd be happy w/--clear-screenthough it isn't exactly very discoverable atm.WDYT?