@@ -4,7 +4,6 @@ import * as os from 'os';
4
4
import * as path from 'path' ;
5
5
import { TextEncoder } from 'util' ;
6
6
import * as vscode from 'vscode' ;
7
- import { Disposable } from 'vscode-languageserver-protocol' ;
8
7
import { CommandNames } from '../../src/commands/constants' ;
9
8
10
9
function getExtension ( ) {
@@ -32,21 +31,21 @@ function getWorkspaceFile(name: string) {
32
31
return wsroot . with ( { path : path . posix . join ( wsroot . path , name ) } ) ;
33
32
}
34
33
35
- const disposables : Disposable [ ] = [ ] ;
34
+ suite ( 'Extension Test Suite' , ( ) => {
35
+ const disposables : vscode . Disposable [ ] = [ ] ;
36
36
37
- async function existsWorkspaceFile ( pattern : string ) {
38
- return new Promise < vscode . Uri > ( ( resolve ) => {
39
- const pat : vscode . RelativePattern = new vscode . RelativePattern ( getWorkspaceRoot ( ) , pattern ) ;
40
- console . log ( `Creating file system watcher for ${ pat } ` ) ;
41
- const watcher = vscode . workspace . createFileSystemWatcher ( pat ) . onDidCreate ( ( uri ) => {
42
- console . log ( `Created: ${ uri } ` ) ;
43
- resolve ( uri ) ;
44
- } ) ;
37
+ async function existsWorkspaceFile ( pattern : string ) {
38
+ const relPath : vscode . RelativePattern = new vscode . RelativePattern ( getWorkspaceRoot ( ) , pattern ) ;
39
+ const watcher = vscode . workspace . createFileSystemWatcher ( relPath ) ;
45
40
disposables . push ( watcher ) ;
46
- } ) ;
47
- }
41
+ return new Promise < vscode . Uri > ( ( resolve ) => {
42
+ watcher . onDidCreate ( ( uri ) => {
43
+ console . log ( `Created: ${ uri } ` ) ;
44
+ resolve ( uri ) ;
45
+ } ) ;
46
+ } ) ;
47
+ }
48
48
49
- suite ( 'Extension Test Suite' , ( ) => {
50
49
vscode . window . showInformationMessage ( 'Start all tests.' ) ;
51
50
52
51
suiteSetup ( async ( ) => {
@@ -66,13 +65,15 @@ suite('Extension Test Suite', () => {
66
65
assert . ok ( true ) ;
67
66
} ) ;
68
67
69
- test ( 'Server executables should be downloaded' , async ( ) => {
68
+ test ( 'HLS executables should be downloaded' , async ( ) => {
70
69
await vscode . workspace . openTextDocument ( getWorkspaceFile ( 'Main.hs' ) ) ;
71
70
const exeExt = os . platform . toString ( ) === 'win32' ? '.exe' : '' ;
71
+ console . log ( 'Testing wrapper' ) ;
72
72
assert . ok (
73
73
await withTimeout ( 30 , existsWorkspaceFile ( `bin/haskell-language-server-wrapper${ exeExt } ` ) ) ,
74
74
'The wrapper executable was not downloaded in 30 seconds'
75
75
) ;
76
+ console . log ( 'Testing server' ) ;
76
77
assert . ok (
77
78
await withTimeout ( 60 , existsWorkspaceFile ( `bin/haskell-language-server${ exeExt } ` ) ) ,
78
79
'The server executable was not downloaded in 30 seconds'
0 commit comments