@@ -5,20 +5,21 @@ import { isWindows, stdout } from '../utils'
55import type { Vitest } from './core'
66
77const keys = [
8- [ 'a' , 'rerun all tests' ] ,
8+ [ [ 'a' , 'return' ] , 'rerun all tests' ] ,
9+ [ 'r' , 'rerun current pattern tests' ] ,
910 [ 'f' , 'rerun only failed tests' ] ,
1011 [ 'u' , 'update snapshot' ] ,
1112 [ 'p' , 'filter by a filename' ] ,
1213 [ 't' , 'filter by a test name regex pattern' ] ,
1314 [ 'q' , 'quit' ] ,
1415]
15- const cancelKeys = [ 'space' , 'c' , ...keys . map ( key => key [ 0 ] ) ]
16+ const cancelKeys = [ 'space' , 'c' , ...keys . map ( key => key [ 0 ] ) . flat ( ) ]
1617
1718export function printShortcutsHelp ( ) {
1819 stdout ( ) . write (
1920 `
2021${ 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' ) }
2223` ,
2324 )
2425}
@@ -63,6 +64,9 @@ export function registerConsoleShortcuts(ctx: Vitest) {
6364 // rerun all tests
6465 if ( name === 'a' || name === 'return' )
6566 return ctx . changeNamePattern ( '' )
67+ // rerun current pattern tests
68+ if ( name === 'r' )
69+ return ctx . rerunFiles ( )
6670 // rerun only failed tests
6771 if ( name === 'f' )
6872 return ctx . rerunFailed ( )
0 commit comments