@@ -19,7 +19,7 @@ function buildVitestArgs({ caseName, casePath, sanitize = true }: { caseName: st
1919 caseName = JSON . stringify ( caseName ) ;
2020 }
2121
22- const args = [ 'vitest' , 'run' , '-t ' , caseName , sanitizedCasePath ] ;
22+ const args = [ 'vitest' , 'run' , '--testNamePattern ' , caseName , sanitizedCasePath ] ;
2323
2424 const rootDir = getCwd ( casePath ) ;
2525 if ( rootDir ) {
@@ -31,7 +31,11 @@ function buildVitestArgs({ caseName, casePath, sanitize = true }: { caseName: st
3131
3232let terminal : vscode . Terminal | undefined ;
3333
34- export function runInTerminal ( text : string , filename : string ) {
34+ async function saveFile ( filePath : string ) {
35+ await vscode . workspace . textDocuments . find ( ( doc ) => doc . fileName === filePath ) ?. save ( ) ;
36+ }
37+
38+ export async function runInTerminal ( text : string , filename : string ) {
3539 let terminalAlreadyExists = true ;
3640 if ( ! terminal || terminal . exitStatus ) {
3741 terminalAlreadyExists = false ;
@@ -47,6 +51,8 @@ export function runInTerminal(text: string, filename: string) {
4751 terminal . sendText ( '\x03' ) ;
4852 }
4953
54+ await saveFile ( filename ) ;
55+
5056 terminal . sendText ( npxArgs . join ( ' ' ) , true ) ;
5157 terminal . show ( ) ;
5258}
@@ -68,7 +74,9 @@ function buildDebugConfig(
6874 } ;
6975}
7076
71- export function debugInTermial ( text : string , filename : string ) {
77+ export async function debugInTerminal ( text : string , filename : string ) {
7278 const config = buildDebugConfig ( filename , text ) ;
79+
80+ await saveFile ( filename ) ;
7381 vscode . debug . startDebugging ( undefined , config ) ;
7482}
0 commit comments