Skip to content

Commit

Permalink
Helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanbrandenburg committed Feb 25, 2020
1 parent 8cb1662 commit e78397c
Show file tree
Hide file tree
Showing 15 changed files with 36 additions and 32 deletions.
4 changes: 2 additions & 2 deletions test/integrationTests/advisor.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as vscode from 'vscode';

import { expect } from 'chai';
import * as path from 'path';
import { activateCSharpExtension } from './integrationHelpers';
import { activateCSharpExtension, isRazorWorkspace } from './integrationHelpers';
import testAssetWorkspace from './testAssets/testAssetWorkspace';

import { Advisor } from '../../src/features/diagnosticsProvider';
Expand All @@ -26,7 +26,7 @@ suite(`Advisor ${testAssetWorkspace.description}`, function () {

suiteSetup(async function () {
// These tests don't run on the BasicRazorApp2_1 solution
if (vscode.workspace.workspaceFolders[0].uri.fsPath.split(path.sep).pop() === 'BasicRazorApp2_1') {
if (isRazorWorkspace(vscode.workspace)) {
this.skip();
}

Expand Down
4 changes: 2 additions & 2 deletions test/integrationTests/codeActionRename.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import * as vscode from 'vscode';

import { should, expect } from 'chai';
import { activateCSharpExtension } from './integrationHelpers';
import { activateCSharpExtension, isRazorWorkspace } from './integrationHelpers';
import testAssetWorkspace from './testAssets/testAssetWorkspace';
import * as path from 'path';
import { assertWithPoll } from './poll';
Expand All @@ -22,7 +22,7 @@ suite(`Code Action Rename ${testAssetWorkspace.description}`, function () {
should();

// These tests don't run on the BasicRazorApp2_1 solution
if (vscode.workspace.workspaceFolders[0].uri.fsPath.split(path.sep).pop() === 'BasicRazorApp2_1') {
if (isRazorWorkspace(vscode.workspace)) {
this.skip();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import * as vscode from 'vscode';
import testAssetWorkspace from "./testAssets/testAssetWorkspace";
import * as path from "path";
import { expect } from "chai";
import { activateCSharpExtension } from "./integrationHelpers";
import { activateCSharpExtension, isRazorWorkspace } from "./integrationHelpers";

suite(`${OmniSharpCompletionItemProvider.name}: Returns the completion items`, () => {
let fileUri: vscode.Uri;

suiteSetup(async function() {
// These tests don't run on the BasicRazorApp2_1 solution
if (vscode.workspace.workspaceFolders[0].uri.fsPath.split(path.sep).pop() === 'BasicRazorApp2_1') {
if (isRazorWorkspace(vscode.workspace)) {
this.skip();
}

Expand Down
4 changes: 2 additions & 2 deletions test/integrationTests/definitionProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import CSharpDefinitionProvider from "../../src/features/definitionProvider";
import * as path from "path";
import testAssetWorkspace from "./testAssets/testAssetWorkspace";
import { expect } from "chai";
import { activateCSharpExtension } from './integrationHelpers';
import { activateCSharpExtension, isRazorWorkspace } from './integrationHelpers';

suite(`${CSharpDefinitionProvider.name}: ${testAssetWorkspace.description}`, () => {
let fileUri: vscode.Uri;

suiteSetup(async function () {
// These tests don't run on the BasicRazorApp2_1 solution
if (vscode.workspace.workspaceFolders[0].uri.fsPath.split(path.sep).pop() === 'BasicRazorApp2_1') {
if (isRazorWorkspace(vscode.workspace)) {
this.skip();
}

Expand Down
8 changes: 4 additions & 4 deletions test/integrationTests/diagnostics.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as vscode from 'vscode';
import * as path from 'path';

import { should, expect } from 'chai';
import { activateCSharpExtension } from './integrationHelpers';
import { activateCSharpExtension, isRazorWorkspace } from './integrationHelpers';
import testAssetWorkspace from './testAssets/testAssetWorkspace';
import { poll, assertWithPoll, pollDoesNotHappen } from './poll';

Expand Down Expand Up @@ -47,7 +47,7 @@ suite(`DiagnosticProvider: ${testAssetWorkspace.description}`, function () {
should();

// These tests only run on the BasicRazorApp2_1 solution
if (vscode.workspace.workspaceFolders[0].uri.fsPath.split(path.sep).pop() !== 'BasicRazorApp2_1') {
if (!isRazorWorkspace(vscode.workspace)) {
this.skip();
}

Expand Down Expand Up @@ -84,7 +84,7 @@ suite(`DiagnosticProvider: ${testAssetWorkspace.description}`, function () {
should();

// These tests don't run on the BasicRazorApp2_1 solution
if (vscode.workspace.workspaceFolders[0].uri.fsPath.split(path.sep).pop() === 'BasicRazorApp2_1') {
if (isRazorWorkspace(vscode.workspace)) {
this.skip();
}

Expand Down Expand Up @@ -127,7 +127,7 @@ suite(`DiagnosticProvider: ${testAssetWorkspace.description}`, function () {
should();

// These tests don't run on the BasicRazorApp2_1 solution
if (vscode.workspace.workspaceFolders[0].uri.fsPath.split(path.sep).pop() === 'BasicRazorApp2_1') {
if (isRazorWorkspace(vscode.workspace)) {
this.skip();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as vscode from 'vscode';
import * as path from 'path';

import { should, expect } from 'chai';
import { activateCSharpExtension } from './integrationHelpers';
import { activateCSharpExtension, isRazorWorkspace } from './integrationHelpers';
import testAssetWorkspace from './testAssets/testAssetWorkspace';

const chai = require('chai');
Expand All @@ -21,7 +21,7 @@ suite(`DocumentSymbolProvider: ${testAssetWorkspace.description}`, function () {
should();

// These tests don't run on the BasicRazorApp2_1 solution
if (vscode.workspace.workspaceFolders[0].uri.fsPath.split(path.sep).pop() === 'BasicRazorApp2_1') {
if (isRazorWorkspace(vscode.workspace)) {
this.skip();
}

Expand Down
4 changes: 2 additions & 2 deletions test/integrationTests/hoverProvider.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as vscode from 'vscode';
import * as path from 'path';

import { should, expect } from 'chai';
import { activateCSharpExtension } from './integrationHelpers';
import { activateCSharpExtension, isRazorWorkspace } from './integrationHelpers';
import testAssetWorkspace from './testAssets/testAssetWorkspace';

const chai = require('chai');
Expand All @@ -19,7 +19,7 @@ suite(`Hover Provider: ${testAssetWorkspace.description}`, function () {
should();

// These tests don't run on the BasicRazorApp2_1 solution
if (vscode.workspace.workspaceFolders[0].uri.fsPath.split(path.sep).pop() === 'BasicRazorApp2_1') {
if (isRazorWorkspace(vscode.workspace)) {
this.skip();
}

Expand Down
4 changes: 2 additions & 2 deletions test/integrationTests/implementationProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import CSharpImplementationProvider from "../../src/features/implementationProvi
import * as path from "path";
import testAssetWorkspace from "./testAssets/testAssetWorkspace";
import { expect } from "chai";
import { activateCSharpExtension } from './integrationHelpers';
import { activateCSharpExtension, isRazorWorkspace } from './integrationHelpers';

suite(`${CSharpImplementationProvider.name}: ${testAssetWorkspace.description}`, () => {
let fileUri: vscode.Uri;

suiteSetup(async function() {
// These tests don't run on the BasicRazorApp2_1 solution
if (vscode.workspace.workspaceFolders[0].uri.fsPath.split(path.sep).pop() === 'BasicRazorApp2_1') {
if (isRazorWorkspace(vscode.workspace)) {
this.skip();
}

Expand Down
6 changes: 6 additions & 0 deletions test/integrationTests/integrationHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import * as path from 'path';
import * as vscode from 'vscode';
import CSharpExtensionExports from '../../src/CSharpExtensionExports';
import { Advisor } from '../../src/features/diagnosticsProvider';
Expand Down Expand Up @@ -34,4 +35,9 @@ export async function activateCSharpExtension(): Promise<ActivationResult | unde
}
}

export function isRazorWorkspace(workspace: typeof vscode.workspace) {
const primeWorkspace = workspace.workspaceFolders[0];
const projectFileName = primeWorkspace.uri.fsPath.split(path.sep).pop();

return projectFileName === 'BasicRazorApp2_1';
}
4 changes: 2 additions & 2 deletions test/integrationTests/languageMiddleware.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as vscode from "vscode";
import * as path from "path";
import testAssetWorkspace from "./testAssets/testAssetWorkspace";
import { expect } from "chai";
import { activateCSharpExtension } from './integrationHelpers';
import { activateCSharpExtension, isRazorWorkspace } from './integrationHelpers';
import { LanguageMiddleware, LanguageMiddlewareFeature } from "../../src/omnisharp/LanguageMiddlewareFeature";

suite(`${LanguageMiddlewareFeature.name}: ${testAssetWorkspace.description}`, () => {
Expand All @@ -16,7 +16,7 @@ suite(`${LanguageMiddlewareFeature.name}: ${testAssetWorkspace.description}`, ()

suiteSetup(async function () {
// These tests don't run on the BasicRazorApp2_1 solution
if (vscode.workspace.workspaceFolders[0].uri.fsPath.split(path.sep).pop() === 'BasicRazorApp2_1') {
if (isRazorWorkspace(vscode.workspace)) {
this.skip();
}

Expand Down
5 changes: 2 additions & 3 deletions test/integrationTests/launchConfiguration.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@

import * as fs from 'async-file';
import * as vscode from 'vscode';
import * as path from 'path';

import { should, expect } from 'chai';
import { activateCSharpExtension } from './integrationHelpers';
import { activateCSharpExtension, isRazorWorkspace } from './integrationHelpers';
import testAssetWorkspace from './testAssets/testAssetWorkspace';
import { poll } from './poll';

Expand All @@ -21,7 +20,7 @@ suite(`Tasks generation: ${testAssetWorkspace.description}`, function () {
should();

// These tests don't run on the BasicRazorApp2_1 solution
if (vscode.workspace.workspaceFolders[0].uri.fsPath.split(path.sep).pop() === 'BasicRazorApp2_1') {
if (isRazorWorkspace(vscode.workspace)) {
this.skip();
}

Expand Down
4 changes: 2 additions & 2 deletions test/integrationTests/reAnalyze.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as vscode from 'vscode';
import * as path from 'path';

import { should, expect } from 'chai';
import { activateCSharpExtension } from './integrationHelpers';
import { activateCSharpExtension, isRazorWorkspace } from './integrationHelpers';
import testAssetWorkspace from './testAssets/testAssetWorkspace';
import { poll, assertWithPoll } from './poll';
import { EventStream } from '../../src/EventStream';
Expand Down Expand Up @@ -42,7 +42,7 @@ suite(`ReAnalyze: ${testAssetWorkspace.description}`, function () {
should();

// These tests don't run on the BasicRazorApp2_1 solution
if (vscode.workspace.workspaceFolders[0].uri.fsPath.split(path.sep).pop() === 'BasicRazorApp2_1') {
if (isRazorWorkspace(vscode.workspace)) {
this.skip();
}

Expand Down
4 changes: 2 additions & 2 deletions test/integrationTests/referenceProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import OmnisharpReferenceProvider from "../../src/features/referenceProvider";
import * as path from "path";
import testAssetWorkspace from "./testAssets/testAssetWorkspace";
import { expect } from "chai";
import { activateCSharpExtension } from './integrationHelpers';
import { activateCSharpExtension, isRazorWorkspace } from './integrationHelpers';

suite(`${OmnisharpReferenceProvider.name}: ${testAssetWorkspace.description}`, () => {
let fileUri: vscode.Uri;

suiteSetup(async function () {
// These tests don't run on the BasicRazorApp2_1 solution
if (vscode.workspace.workspaceFolders[0].uri.fsPath.split(path.sep).pop() === 'BasicRazorApp2_1') {
if (isRazorWorkspace(vscode.workspace)) {
this.skip();
}

Expand Down
4 changes: 2 additions & 2 deletions test/integrationTests/signatureHelp.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as vscode from 'vscode';
import * as path from 'path';

import { expect } from 'chai';
import { activateCSharpExtension } from './integrationHelpers';
import { activateCSharpExtension, isRazorWorkspace } from './integrationHelpers';
import testAssetWorkspace from './testAssets/testAssetWorkspace';

const chai = require('chai');
Expand All @@ -19,7 +19,7 @@ suite(`SignatureHelp: ${testAssetWorkspace.description}`, function () {

suiteSetup(async function () {
// These tests don't run on the BasicRazorApp2_1 solution
if (vscode.workspace.workspaceFolders[0].uri.fsPath.split(path.sep).pop() === 'BasicRazorApp2_1') {
if (isRazorWorkspace(vscode.workspace)) {
this.skip();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
*--------------------------------------------------------------------------------------------*/

import * as vscode from 'vscode';
import * as path from 'path';

import { expect } from 'chai';
import { activateCSharpExtension } from './integrationHelpers';
import { activateCSharpExtension, isRazorWorkspace } from './integrationHelpers';
import testAssetWorkspace from './testAssets/testAssetWorkspace';
const chai = require('chai');
chai.use(require('chai-arrays'));
Expand All @@ -17,7 +16,7 @@ suite(`WorkspaceSymbolProvider: ${testAssetWorkspace.description}`, function ()

suiteSetup(async function () {
// These tests don't run on the BasicRazorApp2_1 solution
if (vscode.workspace.workspaceFolders[0].uri.fsPath.split(path.sep).pop() === 'BasicRazorApp2_1') {
if (isRazorWorkspace(vscode.workspace)) {
this.skip();
}

Expand Down

0 comments on commit e78397c

Please sign in to comment.