Skip to content

Commit 56e0aea

Browse files
committed
Use RelativePattern
1 parent 518707c commit 56e0aea

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

test/suite/extension.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// tslint:disable: no-console
12
import * as assert from 'assert';
23
import * as os from 'os';
34
import * as path from 'path';
@@ -23,21 +24,21 @@ function getHaskellConfig() {
2324
}
2425

2526
function getWorkspaceRoot() {
26-
return vscode.workspace.workspaceFolders![0]!.uri;
27+
return vscode.workspace.workspaceFolders![0];
2728
}
2829

2930
function getWorkspaceFile(name: string) {
30-
const wsroot = getWorkspaceRoot();
31+
const wsroot = getWorkspaceRoot().uri;
3132
return wsroot.with({ path: path.posix.join(wsroot.path, name) });
3233
}
3334

3435
const disposables: Disposable[] = [];
3536

36-
async function existsWorkspaceFile(fileRelativePath: string) {
37+
async function existsWorkspaceFile(pattern: string) {
3738
return new Promise<vscode.Uri>((resolve) => {
38-
// tslint:disable: no-console
39-
console.log(`Creating file system watcher for ${fileRelativePath}`);
40-
const watcher = vscode.workspace.createFileSystemWatcher(`**${fileRelativePath}`).onDidCreate((uri) => {
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) => {
4142
console.log(`Created: ${uri}`);
4243
resolve(uri);
4344
});
@@ -86,8 +87,7 @@ suite('Extension Test Suite', () => {
8687
suiteTeardown(async () => {
8788
disposables.forEach((d) => d.dispose());
8889
await vscode.commands.executeCommand(CommandNames.StopServerCommandName);
89-
const dirContents = await vscode.workspace.fs.readDirectory(getWorkspaceRoot());
90-
// tslint:disable: no-console
90+
const dirContents = await vscode.workspace.fs.readDirectory(getWorkspaceRoot().uri);
9191
console.log(`Deleting test ws contents: ${dirContents}`);
9292
dirContents.forEach(async ([name, type]) => {
9393
const uri: vscode.Uri = getWorkspaceFile(name);

0 commit comments

Comments
 (0)