Skip to content

Commit 9519b35

Browse files
authored
Merge branch 'main' into RazorTelemetryVersion
2 parents c7131b6 + ba8e118 commit 9519b35

File tree

188 files changed

+1311
-2470
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+1311
-2470
lines changed

.vscode/launch.json

Lines changed: 57 additions & 206 deletions
Large diffs are not rendered by default.

.vscode/settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
},
1717
"csharp.suppressDotnetRestoreNotification": true,
1818
"typescript.tsdk": "./node_modules/typescript/lib",
19-
"mocha.enabled": true,
2019
"omnisharp.autoStart": false,
2120
"editor.formatOnSave": false,
2221
"eslint.lintTask.enable": true,

.vscodeignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ CODEOWNERS
3535
gulpfile.ts
3636
!install.Lock
3737
ISSUE_TEMPLATE
38-
.mocharc.jsonc
3938
!README.md
4039
!CHANGELOG.md
4140
*.md

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
- Debug from .csproj and .sln [#5876](https://github.com/dotnet/vscode-csharp/issues/5876)
77

88
## Latest
9+
* Update Razor to 7.0.0-preview.23516.2 (PR: [#6550](https://github.com/dotnet/vscode-csharp/pull/6550))
10+
* Make sure correct info is passed in code action resolve (PR: [razor#9420](https://github.com/dotnet/razor/pull/9420))
11+
12+
## 2.7.?
913
* Update Razor to 7.0.0-preview.23513.5 (PR: [#6551](https://github.com/dotnet/vscode-csharp/pull/6551))
1014
* Reduce noisy errors when viewing git diff (PR: [razor#9407](https://github.com/dotnet/razor/pull/9407))
1115
* Update Roslyn to 4.9.0-1.23513.7 (PR: [#6548](https://github.com/dotnet/vscode-csharp/pull/6548))

azure-pipelines/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ stages:
3131
targetPath: '$(Build.SourcesDirectory)/vsix'
3232
artifactName: 'VSIX_Prerelease_$(System.JobAttempt)'
3333

34-
- script: npm run omnisharptest:artifacts
34+
- script: npm run test:artifacts
3535
displayName: 'Run artifacts tests'
3636

3737
- job:
@@ -58,6 +58,6 @@ stages:
5858
targetPath: '$(Build.SourcesDirectory)/vsix'
5959
artifactName: 'VSIX_Release_$(System.JobAttempt)'
6060

61-
- script: npm run omnisharptest:artifacts
61+
- script: npm run test:artifacts
6262
displayName: 'Run artifacts tests'
6363

jest.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ const config: Config = {
1010
'<rootDir>/test/integrationTests/jest.config.ts',
1111
'<rootDir>/test/razorIntegrationTests/jest.config.ts',
1212
'<rootDir>/test/razorTests/jest.config.ts',
13+
'<rootDir>/test/artifactTests/jest.config.ts',
1314
'<rootDir>/omnisharptest/omnisharpUnitTests/jest.config.ts',
15+
'<rootDir>/omnisharptest/omnisharpIntegrationTests/jest.config.ts',
1416
],
1517
};
1618

omnisharptest/omnisharpFeatureTests/index.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

omnisharptest/omnisharpIntegrationTests/advisor.integration.test.ts

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import * as vscode from 'vscode';
7-
8-
import { expect, should } from 'chai';
6+
import { expect, test, beforeAll, afterAll } from '@jest/globals';
97
import * as path from 'path';
10-
import { activateCSharpExtension, isRazorWorkspace, isSlnWithGenerator } from './integrationHelpers';
8+
import * as vscode from 'vscode';
9+
import { activateCSharpExtension, describeIfNotRazorOrGenerator } from './integrationHelpers';
1110
import testAssetWorkspace from './testAssets/activeTestAssetWorkspace';
1211

1312
import { Advisor } from '../../src/features/diagnosticsProvider';
@@ -17,16 +16,10 @@ function setLimit(to: number | null) {
1716
return csharpConfig.update('maxProjectFileCountForDiagnosticAnalysis', to);
1817
}
1918

20-
suite(`Advisor ${testAssetWorkspace.description}`, function () {
19+
describeIfNotRazorOrGenerator(`Advisor ${testAssetWorkspace.description}`, function () {
2120
let advisor: Advisor;
2221

23-
suiteSetup(async function () {
24-
should();
25-
26-
if (isRazorWorkspace(vscode.workspace) || isSlnWithGenerator(vscode.workspace)) {
27-
this.skip();
28-
}
29-
22+
beforeAll(async function () {
3023
const activation = await activateCSharpExtension();
3124
await testAssetWorkspace.restore();
3225

@@ -40,43 +33,43 @@ suite(`Advisor ${testAssetWorkspace.description}`, function () {
4033
await testAssetWorkspace.waitForIdle(activation.eventStream);
4134
});
4235

43-
suiteTeardown(async () => {
36+
afterAll(async () => {
4437
await testAssetWorkspace.cleanupWorkspace();
4538
});
4639

4740
test('Advisor.shouldValidateAll returns true when maxProjectFileCountForDiagnosticAnalysis is higher than the file count', async () => {
4841
await setLimit(1000);
4942

50-
expect(advisor.shouldValidateAll()).to.be.true;
43+
expect(advisor.shouldValidateAll()).toBe(true);
5144
});
5245

5346
test('Advisor.shouldValidateFiles returns true when maxProjectFileCountForDiagnosticAnalysis is higher than the file count', async () => {
5447
await setLimit(1000);
5548

56-
expect(advisor.shouldValidateFiles()).to.be.true;
49+
expect(advisor.shouldValidateFiles()).toBe(true);
5750
});
5851

5952
test('Advisor.shouldValidateAll returns false when maxProjectFileCountForDiagnosticAnalysis is lower than the file count', async () => {
6053
await setLimit(1);
6154

62-
expect(advisor.shouldValidateAll()).to.be.false;
55+
expect(advisor.shouldValidateAll()).toBe(false);
6356
});
6457

6558
test('Advisor.shouldValidateFiles returns true when maxProjectFileCountForDiagnosticAnalysis is lower than the file count', async () => {
6659
await setLimit(1);
6760

68-
expect(advisor.shouldValidateFiles()).to.be.true;
61+
expect(advisor.shouldValidateFiles()).toBe(true);
6962
});
7063

7164
test('Advisor.shouldValidateAll returns true when maxProjectFileCountForDiagnosticAnalysis is null', async () => {
7265
await setLimit(null);
7366

74-
expect(advisor.shouldValidateAll()).to.be.true;
67+
expect(advisor.shouldValidateAll()).toBe(true);
7568
});
7669

7770
test('Advisor.shouldValidateFiles returns true when maxProjectFileCountForDiagnosticAnalysis is null', async () => {
7871
await setLimit(null);
7972

80-
expect(advisor.shouldValidateFiles()).to.be.true;
73+
expect(advisor.shouldValidateFiles()).toBe(true);
8174
});
8275
});

omnisharptest/omnisharpIntegrationTests/codeActionRename.integration.test.ts

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,18 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6+
import { expect, test, beforeAll, afterAll, describe } from '@jest/globals';
67
import * as vscode from 'vscode';
7-
8-
import { should, expect } from 'chai';
9-
import { activateCSharpExtension, isRazorWorkspace, isSlnWithGenerator } from './integrationHelpers';
8+
import { activateCSharpExtension } from './integrationHelpers';
109
import testAssetWorkspace from './testAssets/activeTestAssetWorkspace';
1110
import * as path from 'path';
1211
import { assertWithPoll } from './poll';
1312
import { isNotNull } from '../testUtil';
1413

15-
suite(`Code Action Rename ${testAssetWorkspace.description}`, function () {
14+
describe.skip(`Code Action Rename ${testAssetWorkspace.description}`, function () {
1615
let fileUri: vscode.Uri;
1716

18-
suiteSetup(async function () {
19-
should();
20-
21-
if (isRazorWorkspace(vscode.workspace) || isSlnWithGenerator(vscode.workspace)) {
22-
this.skip();
23-
}
24-
17+
beforeAll(async function () {
2518
const activation = await activateCSharpExtension();
2619
await testAssetWorkspace.restoreAndWait(activation);
2720

@@ -31,7 +24,7 @@ suite(`Code Action Rename ${testAssetWorkspace.description}`, function () {
3124
fileUri = vscode.Uri.file(filePath);
3225
});
3326

34-
suiteTeardown(async () => {
27+
afterAll(async () => {
3528
await testAssetWorkspace.cleanupWorkspace();
3629
});
3730

@@ -43,7 +36,7 @@ suite(`Code Action Rename ${testAssetWorkspace.description}`, function () {
4336
new vscode.Range(0, 7, 0, 7)
4437
);
4538
const codeAction = codeActions.find((codeAction) => codeAction.title == 'Rename file to C.cs');
46-
expect(codeAction, "Didn't find rename class code action");
39+
expect(codeAction).toBeDefined();
4740
isNotNull(codeAction?.command?.command);
4841
isNotNull(codeAction?.command?.arguments);
4942

@@ -55,7 +48,7 @@ suite(`Code Action Rename ${testAssetWorkspace.description}`, function () {
5548
},
5649
15 * 1000,
5750
500,
58-
(_) => expect(vscode.window.activeTextEditor!.document.fileName).contains('C.cs')
51+
(_) => expect(vscode.window.activeTextEditor!.document.fileName).toContain('C.cs')
5952
);
6053
});
6154
});

omnisharptest/omnisharpIntegrationTests/codeLensProvider.integration.test.ts

Lines changed: 32 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,17 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6+
import { expect, test, beforeAll, afterAll } from '@jest/globals';
67
import * as vscode from 'vscode';
78
import * as path from 'path';
8-
9-
import { should, expect } from 'chai';
10-
import { activateCSharpExtension, isSlnWithCsproj, isSlnWithGenerator } from './integrationHelpers';
9+
import { activateCSharpExtension, describeIfSlnWithCsProj, describeIfNotGenerator } from './integrationHelpers';
1110
import testAssetWorkspace from './testAssets/activeTestAssetWorkspace';
1211
import { isNotNull } from '../testUtil';
1312

14-
suite(`CodeLensProvider: ${testAssetWorkspace.description}`, function () {
13+
describeIfNotGenerator(`CodeLensProvider: ${testAssetWorkspace.description}`, function () {
1514
let fileUri: vscode.Uri;
1615

17-
suiteSetup(async function () {
18-
if (isSlnWithGenerator(vscode.workspace)) {
19-
this.skip();
20-
}
21-
22-
should();
16+
beforeAll(async function () {
2317
const activation = await activateCSharpExtension();
2418
await testAssetWorkspace.restore();
2519

@@ -37,55 +31,49 @@ suite(`CodeLensProvider: ${testAssetWorkspace.description}`, function () {
3731
await testAssetWorkspace.waitForIdle(activation.eventStream);
3832
});
3933

40-
suiteTeardown(async () => {
34+
afterAll(async () => {
4135
await testAssetWorkspace.cleanupWorkspace();
4236
});
4337

4438
test('Returns all code lenses', async function () {
4539
const codeLenses = await GetCodeLenses(fileUri);
46-
expect(codeLenses.length).to.equal(2);
40+
expect(codeLenses.length).toEqual(2);
4741

4842
for (const codeLens of codeLenses) {
49-
expect(codeLens.isResolved).to.be.false;
50-
expect(codeLens.command).to.be.undefined;
43+
expect(codeLens.isResolved).toBe(false);
44+
expect(codeLens.command).toBe(undefined);
5145
}
5246
});
5347

5448
test('Returns all resolved code lenses', async function () {
5549
const codeLenses = await GetCodeLenses(fileUri, 100);
56-
expect(codeLenses.length).to.equal(2);
50+
expect(codeLenses.length).toEqual(2);
5751

5852
for (const codeLens of codeLenses) {
59-
expect(codeLens.isResolved).to.be.true;
53+
expect(codeLens.isResolved).toBe(true);
6054
isNotNull(codeLens.command);
61-
expect(codeLens.command.title).to.equal('0 references');
55+
expect(codeLens.command.title).toEqual('0 references');
6256
}
6357
});
6458
});
6559

66-
suite(`CodeLensProvider options: ${testAssetWorkspace.description}`, function () {
60+
// These tests only run on the slnWithCsproj solution
61+
describeIfSlnWithCsProj(`CodeLensProvider options: ${testAssetWorkspace.description}`, function () {
6762
let fileUri: vscode.Uri;
6863

69-
suiteSetup(async function () {
70-
should();
71-
72-
// These tests only run on the slnWithCsproj solution
73-
if (!isSlnWithCsproj(vscode.workspace)) {
74-
this.skip();
75-
} else {
76-
const activation = await activateCSharpExtension();
77-
await testAssetWorkspace.restoreAndWait(activation);
64+
beforeAll(async function () {
65+
const activation = await activateCSharpExtension();
66+
await testAssetWorkspace.restoreAndWait(activation);
7867

79-
const fileName = 'UnitTest1.cs';
80-
const projectDirectory = testAssetWorkspace.projects[2].projectDirectoryPath;
81-
const filePath = path.join(projectDirectory, fileName);
82-
fileUri = vscode.Uri.file(filePath);
68+
const fileName = 'UnitTest1.cs';
69+
const projectDirectory = testAssetWorkspace.projects[2].projectDirectoryPath;
70+
const filePath = path.join(projectDirectory, fileName);
71+
fileUri = vscode.Uri.file(filePath);
8372

84-
await vscode.commands.executeCommand('vscode.open', fileUri);
85-
}
73+
await vscode.commands.executeCommand('vscode.open', fileUri);
8674
});
8775

88-
suiteTeardown(async () => {
76+
afterAll(async () => {
8977
await testAssetWorkspace.cleanupWorkspace();
9078
});
9179

@@ -96,18 +84,18 @@ suite(`CodeLensProvider options: ${testAssetWorkspace.description}`, function ()
9684
await csharpConfig.update('codeLens.enableTestsCodeLens', true);
9785

9886
const codeLenses = await GetCodeLenses(fileUri, 100);
99-
expect(codeLenses.length).to.equal(4);
87+
expect(codeLenses.length).toEqual(4);
10088

10189
for (const codeLens of codeLenses) {
102-
expect(codeLens.isResolved).to.be.true;
90+
expect(codeLens.isResolved).toBe(true);
10391
isNotNull(codeLens.command);
104-
expect(codeLens.command.command).to.be.oneOf([
92+
expect([
10593
'dotnet.test.run',
10694
'dotnet.classTests.run',
10795
'dotnet.test.debug',
10896
'dotnet.classTests.debug',
109-
]);
110-
expect(codeLens.command.title).to.be.oneOf(['Run Test', 'Run All Tests', 'Debug Test', 'Debug All Tests']);
97+
]).toContain(codeLens.command.command);
98+
expect(['Run Test', 'Run All Tests', 'Debug Test', 'Debug All Tests']).toContain(codeLens.command.title);
11199
}
112100
});
113101

@@ -117,13 +105,13 @@ suite(`CodeLensProvider options: ${testAssetWorkspace.description}`, function ()
117105
await csharpConfig.update('codeLens.enableTestsCodeLens', false);
118106

119107
const codeLenses = await GetCodeLenses(fileUri, 100);
120-
expect(codeLenses.length).to.equal(3);
108+
expect(codeLenses.length).toEqual(3);
121109

122110
for (const codeLens of codeLenses) {
123-
expect(codeLens.isResolved).to.be.true;
111+
expect(codeLens.isResolved).toBe(true);
124112
isNotNull(codeLens.command);
125-
expect(codeLens.command.command).to.be.equal('editor.action.showReferences');
126-
expect(codeLens.command.title).to.equal('0 references');
113+
expect(codeLens.command.command).toEqual('editor.action.showReferences');
114+
expect(codeLens.command.title).toEqual('0 references');
127115
}
128116
});
129117

@@ -133,7 +121,7 @@ suite(`CodeLensProvider options: ${testAssetWorkspace.description}`, function ()
133121
await csharpConfig.update('codeLens.enableTestsCodeLens', false);
134122

135123
const codeLenses = await GetCodeLenses(fileUri, 100);
136-
expect(codeLenses.length).to.equal(0);
124+
expect(codeLenses.length).toEqual(0);
137125
});
138126
});
139127

0 commit comments

Comments
 (0)