@@ -5,20 +5,21 @@ import { isWindows, stdout } from '../utils'
5
5
import type { Vitest } from './core'
6
6
7
7
const keys = [
8
- [ 'a' , 'rerun all tests' ] ,
8
+ [ [ 'a' , 'return' ] , 'rerun all tests' ] ,
9
+ [ 'r' , 'rerun current pattern tests' ] ,
9
10
[ 'f' , 'rerun only failed tests' ] ,
10
11
[ 'u' , 'update snapshot' ] ,
11
12
[ 'p' , 'filter by a filename' ] ,
12
13
[ 't' , 'filter by a test name regex pattern' ] ,
13
14
[ 'q' , 'quit' ] ,
14
15
]
15
- const cancelKeys = [ 'space' , 'c' , ...keys . map ( key => key [ 0 ] ) ]
16
+ const cancelKeys = [ 'space' , 'c' , ...keys . map ( key => key [ 0 ] ) . flat ( ) ]
16
17
17
18
export function printShortcutsHelp ( ) {
18
19
stdout ( ) . write (
19
20
`
20
21
${ c . bold ( ' Watch Usage' ) }
21
- ${ keys . map ( i => c . dim ( ' press ' ) + c . reset ( c . bold ( i [ 0 ] ) ) + c . dim ( ` to ${ i [ 1 ] } ` ) ) . join ( '\n' ) }
22
+ ${ keys . map ( i => c . dim ( ' press ' ) + c . reset ( [ i [ 0 ] ] . flat ( ) . map ( c . bold ) . join ( ', ' ) ) + c . dim ( ` to ${ i [ 1 ] } ` ) ) . join ( '\n' ) }
22
23
` ,
23
24
)
24
25
}
@@ -63,6 +64,9 @@ export function registerConsoleShortcuts(ctx: Vitest) {
63
64
// rerun all tests
64
65
if ( name === 'a' || name === 'return' )
65
66
return ctx . changeNamePattern ( '' )
67
+ // rerun current pattern tests
68
+ if ( name === 'r' )
69
+ return ctx . rerunFiles ( )
66
70
// rerun only failed tests
67
71
if ( name === 'f' )
68
72
return ctx . rerunFailed ( )
0 commit comments