-
Notifications
You must be signed in to change notification settings - Fork 686
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integration-test Advisor project analysis file limit
1 parent
877f314
commit 3080763
Showing
4 changed files
with
81 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import * as vscode from 'vscode'; | ||
|
||
import { expect } from 'chai'; | ||
import * as path from 'path'; | ||
import { activateCSharpExtension } from './integrationHelpers'; | ||
import testAssetWorkspace from './testAssets/testAssetWorkspace'; | ||
|
||
import { advisor } from "../../src/omnisharp/extension"; | ||
|
||
const chai = require('chai'); | ||
chai.use(require('chai-arrays')); | ||
chai.use(require('chai-fs')); | ||
|
||
function setLimit(to: number | null) { | ||
let csharpConfig = vscode.workspace.getConfiguration('csharp'); | ||
return csharpConfig.update('maxProjectFileCountForDiagnosticAnalysis', to); | ||
} | ||
|
||
suite(`Diagnostics Provider ${testAssetWorkspace.description}`, function () { | ||
suiteSetup(async function () { | ||
await testAssetWorkspace.restore(); | ||
await activateCSharpExtension(); | ||
|
||
let fileName = 'completion.cs'; | ||
let dir = testAssetWorkspace.projects[0].projectDirectoryPath; | ||
let fileUri = vscode.Uri.file(path.join(dir, fileName)); | ||
await vscode.commands.executeCommand('vscode.open', fileUri); | ||
}); | ||
|
||
suiteTeardown(async () => { | ||
await testAssetWorkspace.cleanupWorkspace(); | ||
}); | ||
|
||
test('Reports errors from whole project when maxProjectFileCountForDiagnosticAnalysis is higher than the file count', async () => { | ||
await setLimit(1000); | ||
|
||
expect(advisor.shouldValidateProject()).to.be.true; | ||
}); | ||
|
||
test('Reports errors from individual files when maxProjectFileCountForDiagnosticAnalysis is higher than the file count', async () => { | ||
await setLimit(1000); | ||
|
||
expect(advisor.shouldValidateFiles()).to.be.true; | ||
}); | ||
|
||
test('Does not report errors from whole project when maxProjectFileCountForDiagnosticAnalysis is lower than the file count', async () => { | ||
await setLimit(1); | ||
|
||
expect(advisor.shouldValidateProject()).to.be.false; | ||
}); | ||
|
||
test('Reports errors from individual files when maxProjectFileCountForDiagnosticAnalysis is lower than the file count', async () => { | ||
await setLimit(1); | ||
|
||
expect(advisor.shouldValidateFiles()).to.be.true; | ||
}); | ||
|
||
test('Reports errors from whole project when maxProjectFileCountForDiagnosticAnalysis is null', async () => { | ||
await setLimit(null); | ||
|
||
expect(advisor.shouldValidateProject()).to.be.true; | ||
}); | ||
|
||
test('Reports errors from individual files when maxProjectFileCountForDiagnosticAnalysis is null', async () => { | ||
await setLimit(null); | ||
|
||
expect(advisor.shouldValidateFiles()).to.be.true; | ||
}); | ||
}); |
1 change: 1 addition & 0 deletions
1
test/integrationTests/testAssets/slnWithCsproj/.vscode/settings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"omnisharp.defaultLaunchSolution": "b_SecondInOrder_SlnFile.sln", | ||
"omnisharp.path": "latest", | ||
"csharp.maxProjectFileCountForDiagnosticAnalysis": 1000, | ||
} |