diff --git a/package.json b/package.json index 540bf9563..b4b58e0f7 100644 --- a/package.json +++ b/package.json @@ -360,7 +360,7 @@ } ], "engines": { - "vscode": "1.45.0" + "vscode": "^1.44.0" }, "activationEvents": [ "onDebugInitialConfigurations", @@ -3241,4 +3241,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integrationTests/launchConfiguration.integration.test.ts b/test/integrationTests/launchConfiguration.integration.test.ts index 366d84ee8..e712ceaf3 100644 --- a/test/integrationTests/launchConfiguration.integration.test.ts +++ b/test/integrationTests/launchConfiguration.integration.test.ts @@ -38,7 +38,8 @@ suite(`Tasks generation: ${testAssetWorkspace.description}`, function () { test("Starting .NET Core Launch (console) from the workspace root should create an Active Debug Session", async () => { - vscode.debug.onDidChangeActiveDebugSession((e) => { + const onChangeSubscription = vscode.debug.onDidChangeActiveDebugSession((e) => { + onChangeSubscription.dispose(); expect(vscode.debug.activeDebugSession).not.to.be.undefined; expect(vscode.debug.activeDebugSession.type).to.equal("coreclr"); }); @@ -47,7 +48,10 @@ suite(`Tasks generation: ${testAssetWorkspace.description}`, function () { expect(result, "Debugger could not be started."); let debugSessionTerminated = new Promise(resolve => { - vscode.debug.onDidTerminateDebugSession((e) => resolve()); + const onTerminateSubscription = vscode.debug.onDidTerminateDebugSession((e) => { + onTerminateSubscription.dispose(); + resolve(); + }); }); await debugSessionTerminated; diff --git a/test/integrationTests/poll.ts b/test/integrationTests/poll.ts index 6bc021b03..97f005af7 100644 --- a/test/integrationTests/poll.ts +++ b/test/integrationTests/poll.ts @@ -44,7 +44,7 @@ export async function assertWithPoll( } function defaultPollExpression(value: T): boolean { - return value !== undefined && ((Array.isArray(value) && value.length > 0) || !Array.isArray(value)); + return value !== undefined && ((Array.isArray(value) && value.length > 0) || (!Array.isArray(value) && !!value)); } export async function pollDoesNotHappen( @@ -68,7 +68,7 @@ export async function pollDoesNotHappen( } export async function poll( - getValue: () => T, + getValue: () => Promise | T, duration: number, step: number, expression: (input: T) => boolean = defaultPollExpression): Promise { diff --git a/test/integrationTests/semanticTokensProvider.test.ts b/test/integrationTests/semanticTokensProvider.test.ts index 257aed53d..68a998d01 100644 --- a/test/integrationTests/semanticTokensProvider.test.ts +++ b/test/integrationTests/semanticTokensProvider.test.ts @@ -72,7 +72,7 @@ suite(`SemanticTokensProvider: ${testAssetWorkspace.description}`, function () { } }); - await poll(() => { }, 25000, 500, _ => isWorkspaceLoaded); + await poll(() => isWorkspaceLoaded, 25000, 500); const fileName = 'semanticTokens.cs'; const projectDirectory = testAssetWorkspace.projects[0].projectDirectoryPath; diff --git a/test/integrationTests/virtualDocumentTracker.integration.test.ts b/test/integrationTests/virtualDocumentTracker.integration.test.ts index fc587d9e1..a2a231d42 100644 --- a/test/integrationTests/virtualDocumentTracker.integration.test.ts +++ b/test/integrationTests/virtualDocumentTracker.integration.test.ts @@ -5,7 +5,7 @@ import * as vscode from 'vscode'; -import { should, expect } from 'chai'; +import { should, assert } from 'chai'; import { activateCSharpExtension } from './integrationHelpers'; import testAssetWorkspace from './testAssets/testAssetWorkspace'; import { IDisposable } from '../../src/Disposable'; @@ -15,16 +15,19 @@ chai.use(require('chai-arrays')); chai.use(require('chai-fs')); suite(`Virtual Document Tracking ${testAssetWorkspace.description}`, function () { - let virtualScheme: string = "virtual"; + const virtualScheme = "virtual"; let virtualDocumentRegistration: IDisposable; + let virtualUri: vscode.Uri; suiteSetup(async function () { should(); - await activateCSharpExtension(); - await testAssetWorkspace.restore(); - let virtualCSharpDocumentProvider = new VirtualCSharpDocumentProvider(); + const virtualCSharpDocumentProvider = new VirtualCSharpDocumentProvider(); virtualDocumentRegistration = vscode.workspace.registerTextDocumentContentProvider(virtualScheme, virtualCSharpDocumentProvider); + virtualUri = vscode.Uri.parse(`${virtualScheme}://${testAssetWorkspace.projects[0].projectDirectoryPath}/_virtualFile.cs`); + + await activateCSharpExtension(); + await testAssetWorkspace.restore(); }); suiteTeardown(async () => { @@ -33,19 +36,12 @@ suite(`Virtual Document Tracking ${testAssetWorkspace.description}`, function () }); test("Virtual documents are operated on.", async () => { - let virtualUri = vscode.Uri.parse(`${virtualScheme}://${testAssetWorkspace.projects[0].projectDirectoryPath}/_virtualFile.cs`); await vscode.workspace.openTextDocument(virtualUri); - let position = new vscode.Position(2, 4); + let position = new vscode.Position(2, 0); let completionItems = await vscode.commands.executeCommand("vscode.executeCompletionItemProvider", virtualUri, position); - expect(completionItems.items).to.satisfy(() => { - let item = completionItems.items.find(item => { - return item.label === "while"; - }); - - return item; - }); + assert.include(completionItems.items.map(({ label }) => label), "while"); }); });