@@ -44,14 +44,16 @@ async function deleteWorkspaceFiles() {
44
44
suite ( 'Extension Test Suite' , ( ) => {
45
45
const disposables : vscode . Disposable [ ] = [ ] ;
46
46
47
- async function existsWorkspaceFile ( pattern : string ) {
47
+ async function existsWorkspaceFile ( pattern : string , pred ?: ( uri : vscode . Uri ) => boolean ) {
48
48
const relPath : vscode . RelativePattern = new vscode . RelativePattern ( getWorkspaceRoot ( ) , pattern ) ;
49
49
const watcher = vscode . workspace . createFileSystemWatcher ( relPath ) ;
50
50
disposables . push ( watcher ) ;
51
51
return new Promise < vscode . Uri > ( ( resolve ) => {
52
52
watcher . onDidCreate ( ( uri ) => {
53
53
console . log ( `Created: ${ uri } ` ) ;
54
- resolve ( uri ) ;
54
+ if ( ! pred || pred ( uri ) ) {
55
+ resolve ( uri ) ;
56
+ }
55
57
} ) ;
56
58
} ) ;
57
59
}
@@ -80,14 +82,15 @@ suite('Extension Test Suite', () => {
80
82
await vscode . workspace . openTextDocument ( getWorkspaceFile ( 'Main.hs' ) ) ;
81
83
const exeExt = os . platform . toString ( ) === 'win32' ? '.exe' : '' ;
82
84
console . log ( 'Testing wrapper' ) ;
85
+ const pred = ( uri : vscode . Uri ) => ! [ 'download' , 'gz' , 'zip' ] . includes ( path . extname ( uri . fsPath ) ) ;
83
86
assert . ok (
84
- await withTimeout ( 30 , existsWorkspaceFile ( `bin/haskell-language-server-wrapper*${ exeExt } [!.]` ) ) ,
87
+ await withTimeout ( 30 , existsWorkspaceFile ( `bin/haskell-language-server-wrapper*${ exeExt } ` , pred ) ) ,
85
88
'The wrapper executable was not downloaded in 30 seconds'
86
89
) ;
87
90
console . log ( 'Testing server' ) ;
88
91
assert . ok (
89
- await withTimeout ( 60 , existsWorkspaceFile ( `bin/haskell-language-server-[1-9]*${ exeExt } [!.]` ) ) ,
90
- 'The server executable was not downloaded in 30 seconds'
92
+ await withTimeout ( 60 , existsWorkspaceFile ( `bin/haskell-language-server-[1-9]*${ exeExt } ` , pred ) ) ,
93
+ 'The server executable was not downloaded in 60 seconds'
91
94
) ;
92
95
} ) ;
93
96
0 commit comments