Commit 53642ae 1 parent 024de32 commit 53642ae Copy full SHA for 53642ae
File tree 2 files changed +14
-0
lines changed
2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,12 @@ const FLAGS = {
91
91
description : 'Re-run tests when files change' ,
92
92
type : 'boolean' ,
93
93
} ,
94
+ 'clear-screen' : {
95
+ alias : 'C' ,
96
+ coerce : coerceLastValue ,
97
+ description : 'Clears the screen before every test run' ,
98
+ type : 'boolean' ,
99
+ } ,
94
100
} ;
95
101
96
102
export default async function loadCli ( ) { // eslint-disable-line complexity
@@ -465,6 +471,7 @@ export default async function loadCli() { // eslint-disable-line complexity
465
471
reportStream : process . stdout ,
466
472
stdStream : process . stderr ,
467
473
watching : argv . watch ,
474
+ clearScreen : argv [ 'clear-screen' ] ,
468
475
} ) ;
469
476
}
470
477
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import path from 'node:path';
3
3
import stream from 'node:stream' ;
4
4
import { fileURLToPath } from 'node:url' ;
5
5
6
+ import ansiEscapes from 'ansi-escapes' ;
6
7
import figures from 'figures' ;
7
8
import indentString from 'indent-string' ;
8
9
import plur from 'plur' ;
@@ -73,12 +74,14 @@ export default class Reporter {
73
74
stdStream,
74
75
projectDir,
75
76
watching,
77
+ clearScreen,
76
78
durationThreshold,
77
79
} ) {
78
80
this . extensions = extensions ;
79
81
this . reportStream = reportStream ;
80
82
this . stdStream = stdStream ;
81
83
this . watching = watching ;
84
+ this . clearScreen = clearScreen ;
82
85
this . relativeFile = file => {
83
86
if ( file . startsWith ( 'file://' ) ) {
84
87
file = fileURLToPath ( file ) ;
@@ -128,6 +131,10 @@ export default class Reporter {
128
131
}
129
132
130
133
startRun ( plan ) {
134
+ if ( this . clearScreen ) {
135
+ this . lineWriter . write ( ansiEscapes . clearTerminal ) ;
136
+ }
137
+
131
138
if ( plan . bailWithoutReporting ) {
132
139
return ;
133
140
}
You can’t perform that action at this time.
0 commit comments