From e7e480a317149761a1751cb4c8e8241e24ef51bd Mon Sep 17 00:00:00 2001 From: Akshita Agarwal Date: Fri, 16 Feb 2018 15:42:54 -0800 Subject: [PATCH 1/2] Race condition between omnisharp and vscode resolved --- .../hoverProvider.integration.test.ts | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/test/integrationTests/hoverProvider.integration.test.ts b/test/integrationTests/hoverProvider.integration.test.ts index 8bf863916..f5c9e5bba 100644 --- a/test/integrationTests/hoverProvider.integration.test.ts +++ b/test/integrationTests/hoverProvider.integration.test.ts @@ -13,27 +13,26 @@ import { RequestQueueCollection } from '../../src/omnisharp/requestQueue'; import { OmniSharpServer } from '../../src/omnisharp/server'; import { omnisharp } from '../../src/omnisharp/extension'; -const chai = require('chai'); -chai.use(require('chai-arrays')); -chai.use(require('chai-fs')); +const chai = require('chai'); +chai.use(require('chai-arrays')); +chai.use(require('chai-fs')); -suite(`Hover Provider: ${testAssetWorkspace.description}`, function() { - suiteSetup(async function() { +suite(`Hover Provider: ${testAssetWorkspace.description}`, function () { + suiteSetup(async function () { should(); - let csharpExtension = vscode.extensions.getExtension("ms-vscode.csharp"); - if (!csharpExtension.isActive) { - await csharpExtension.activate(); + let csharpExtension = vscode.extensions.getExtension("ms-vscode.csharp"); + if (!csharpExtension.isActive) { + await csharpExtension.activate(); } await csharpExtension.exports.initializationFinished; - await omnisharp.restart(); - }); + }); - test("Hover returns structured documentation with proper newlines", async function () { + test("Hover returns structured documentation with proper newlines", async function () { - let program = -`using System; + let program = + `using System; namespace Test { class testissue @@ -49,16 +48,17 @@ namespace Test } } }`; - let fileUri = await testAssetWorkspace.projects[0].addFileWithContents("test1.cs", program); + let fileUri = await testAssetWorkspace.projects[0].addFileWithContents("test1.cs", program); - await omnisharp.waitForEmptyEventQueue(); + await omnisharp.restart(); + await omnisharp.waitForEmptyEventQueue(); - await vscode.commands.executeCommand("vscode.open", fileUri); + await vscode.workspace.openTextDocument(fileUri); - let c = await vscode.commands.executeCommand("vscode.executeHoverProvider", fileUri,new vscode.Position(10,29)); + let c = await vscode.commands.executeCommand("vscode.executeHoverProvider", fileUri, new vscode.Position(10, 29)); - let answer:string = -`Checks if object is tagged with the tag. + let answer: string = + `Checks if object is tagged with the tag. Parameters: @@ -66,9 +66,9 @@ Parameters: \t\ttagName: Name of the tag. Returns true if object is tagged with tag.`; - expect(c[0].contents[0].value).to.equal(answer); + expect(c[0].contents[0].value).to.equal(answer); }); - + teardown(async () => { await testAssetWorkspace.cleanupWorkspace(); }); From 80f62083fd8d2c272a2f52e4780ec155ee3e51f9 Mon Sep 17 00:00:00 2001 From: Akshita Agarwal Date: Fri, 16 Feb 2018 15:55:45 -0800 Subject: [PATCH 2/2] Clean up --- test/integrationTests/hoverProvider.integration.test.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/test/integrationTests/hoverProvider.integration.test.ts b/test/integrationTests/hoverProvider.integration.test.ts index f5c9e5bba..f842cfa89 100644 --- a/test/integrationTests/hoverProvider.integration.test.ts +++ b/test/integrationTests/hoverProvider.integration.test.ts @@ -48,15 +48,11 @@ namespace Test } } }`; - let fileUri = await testAssetWorkspace.projects[0].addFileWithContents("test1.cs", program); - + let fileUri = await testAssetWorkspace.projects[0].addFileWithContents("hover.cs", program); await omnisharp.restart(); await omnisharp.waitForEmptyEventQueue(); - - await vscode.workspace.openTextDocument(fileUri); - + await vscode.commands.executeCommand("vscode.open", fileUri); let c = await vscode.commands.executeCommand("vscode.executeHoverProvider", fileUri, new vscode.Position(10, 29)); - let answer: string = `Checks if object is tagged with the tag. @@ -66,6 +62,7 @@ Parameters: \t\ttagName: Name of the tag. Returns true if object is tagged with tag.`; + expect(c[0].contents[0].value).to.equal(answer); });