File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,11 @@ export function registerConsoleShortcuts(
149149 } )
150150
151151 on ( )
152+
153+ if ( typeof filter === 'undefined' ) {
154+ return
155+ }
156+
152157 const files = ctx . state . getFilepaths ( )
153158 // if running in standalone mode, Vitest instance doesn't know about any test file
154159 const cliFiles
@@ -193,6 +198,10 @@ export function registerConsoleShortcuts(
193198
194199 on ( )
195200
201+ if ( typeof filter === 'undefined' ) {
202+ return
203+ }
204+
196205 latestFilename = filter ?. trim ( ) || ''
197206 const lastResults = watchFilter . getLastResults ( )
198207
Original file line number Diff line number Diff line change @@ -74,9 +74,9 @@ export class WatchFilter {
7474 break
7575 case key ?. ctrl && key ?. name === 'c' :
7676 case key ?. name === 'escape' :
77- this . cancel ( )
77+ this . write ( ` ${ ESC } 1G ${ ESC } 0J` ) // clean content
7878 onSubmit ( undefined )
79- break
79+ return
8080 case key ?. name === 'enter' :
8181 case key ?. name === 'return' :
8282 onSubmit (
@@ -224,10 +224,6 @@ export class WatchFilter {
224224 this . write ( `${ ESC } ${ cursortPos } G` )
225225 }
226226
227- private cancel ( ) {
228- this . write ( `${ ESC } J` ) // erase down
229- }
230-
231227 private write ( data : string ) {
232228 // @ts -expect-error -- write() method has different signature on the union type
233229 this . stdout . write ( data )
You can’t perform that action at this time.
0 commit comments