File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -18,10 +18,23 @@ export default function runFromCodeLens(args: RunArgs): void {
18
18
elixirLsTerminal . sendText ( buildTestCommand ( args ) )
19
19
}
20
20
21
+ function escapeSingleQuotes ( s : string ) : string {
22
+ return isWindows ( ) ? s : s . replace ( / ' / g, "'\\''" ) ;
23
+ }
24
+
25
+ function quote ( s : string ) : string {
26
+ const q = isWindows ( ) ? '"' : `'` ;
27
+ return [ q , s , q ] . join ( '' ) ;
28
+ }
29
+
30
+ function isWindows ( ) : boolean {
31
+ return process . platform . includes ( 'win32' ) ;
32
+ }
33
+
21
34
function buildTestCommand ( args : RunArgs ) : string {
22
35
const testFilter = buildTestInclude ( args . describe , args . testName , args . module )
23
36
24
- return `mix test --exclude test --include " ${ testFilter } " ${ args . filePath } `
37
+ return `mix test --exclude test --include ${ quote ( escapeSingleQuotes ( testFilter ) ) } ${ args . filePath } `
25
38
}
26
39
27
40
function buildTestInclude ( describe : string | null , testName ?: string , module ?: string ) {
You can’t perform that action at this time.
0 commit comments