Skip to content

Commit 1426bf4

Browse files
committed
Update integration tests to run against C# Dev Kit as well
Fixup tasks Separate integration tests into more CI jobs
1 parent ceac6ad commit 1426bf4

File tree

51 files changed

+603
-312
lines changed

Some content is hidden

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

51 files changed

+603
-312
lines changed

.vscode/launch.json

+34-9
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
"args": [
2020
// Launch VSCode using a specific profile to ensure that user settings are not used.
2121
// This profile must be imported into vscode before running this launch configuration.
22-
// The profile can be found under /test/csharp-standalone-profile.
22+
// The profile can be found under /test/csharp-test-profile.
2323
"--profile",
24-
"csharp-standalone-profile",
25-
"${workspaceRoot}/test/lsptoolshost/integrationTests/testAssets/slnWithCsproj/.vscode/lsp_tools_host_slnWithCsproj.code-workspace",
24+
"csharp-test-profile",
25+
"${workspaceRoot}/test/lsptoolshost/integrationTests/testAssets/slnWithCsproj/.vscode/slnWithCsproj.code-workspace",
2626
"--extensionDevelopmentPath=${workspaceRoot}",
2727
"--extensionTestsPath=${workspaceRoot}/out/test/lsptoolshost/integrationTests"
2828
],
@@ -36,6 +36,31 @@
3636
"preLaunchTask": "buildDev",
3737
"internalConsoleOptions": "openOnSessionStart"
3838
},
39+
{
40+
"name": "[DevKit] Launch Current File slnWithCsproj Integration Tests",
41+
"type": "extensionHost",
42+
"request": "launch",
43+
"runtimeExecutable": "${execPath}",
44+
"args": [
45+
// Launch VSCode using a specific profile to ensure that user settings are not used.
46+
// This profile must be imported into vscode before running this launch configuration.
47+
// The profile can be found under /test/csharp-test-profile.
48+
"--profile",
49+
"csharp-test-profile",
50+
"${workspaceRoot}/test/lsptoolshost/integrationTests/testAssets/slnWithCsproj/.vscode/devkit_slnWithCsproj.code-workspace",
51+
"--extensionDevelopmentPath=${workspaceRoot}",
52+
"--extensionTestsPath=${workspaceRoot}/out/test/lsptoolshost/integrationTests"
53+
],
54+
"env": {
55+
"CODE_EXTENSIONS_PATH": "${workspaceRoot}",
56+
"TEST_FILE_FILTER": "${file}",
57+
},
58+
"sourceMaps": true,
59+
"outFiles": ["${workspaceRoot}/dist/*.js", "${workspaceRoot}/out/test/**/*.js"],
60+
"resolveSourceMapLocations": ["${workspaceFolder}/**", "!**/node_modules/**"],
61+
"preLaunchTask": "buildDev",
62+
"internalConsoleOptions": "openOnSessionStart"
63+
},
3964
{
4065
"name": "Launch Current File BasicRazorApp2_1 Integration Tests",
4166
"type": "extensionHost",
@@ -44,9 +69,9 @@
4469
"args": [
4570
// Launch VSCode using a specific profile to ensure that user settings are not used.
4671
// This profile must be imported into vscode before running this launch configuration.
47-
// The profile can be found under /test/csharp-standalone-profile.
72+
// The profile can be found under /test/csharp-test-profile.
4873
"--profile",
49-
"csharp-standalone-profile",
74+
"csharp-test-profile",
5075
"${workspaceRoot}/test/razor/razorIntegrationTests/testAssets/BasicRazorApp2_1/.vscode/lsp_tools_host_BasicRazorApp2_1.code-workspace",
5176
"--extensionDevelopmentPath=${workspaceRoot}",
5277
"--extensionTestsPath=${workspaceRoot}/out/test/razor/razorIntegrationTests"
@@ -69,9 +94,9 @@
6994
"args": [
7095
// Launch VSCode using a specific profile to ensure that user settings are not used.
7196
// This profile must be imported into vscode before running this launch configuration.
72-
// The profile can be found under /test/csharp-standalone-profile.
97+
// The profile can be found under /test/csharp-test-profile.
7398
"--profile",
74-
"csharp-standalone-profile",
99+
"csharp-test-profile",
75100
"${workspaceRoot}/test/omnisharp/omnisharpIntegrationTests/testAssets/${input:omnisharpAssetName}/.vscode/omnisharp_${input:omnisharpAssetName}.code-workspace",
76101
"--extensionDevelopmentPath=${workspaceRoot}",
77102
"--extensionTestsPath=${workspaceRoot}/out/test/omnisharp/omnisharpIntegrationTests"
@@ -94,9 +119,9 @@
94119
"args": [
95120
// Launch VSCode using a specific profile to ensure that user settings are not used.
96121
// This profile must be imported into vscode before running this launch configuration.
97-
// The profile can be found under /test/csharp-standalone-profile.
122+
// The profile can be found under /test/csharp-test-profile.
98123
"--profile",
99-
"csharp-standalone-profile",
124+
"csharp-test-profile",
100125
"${workspaceRoot}/test/omnisharp/omnisharpIntegrationTests/testAssets/${input:omnisharpAssetName}/.vscode/omnisharp_lsp_${input:omnisharpAssetName}.code-workspace",
101126
"--extensionDevelopmentPath=${workspaceRoot}",
102127
"--extensionTestsPath=${workspaceRoot}/out/test/omnisharp/omnisharpIntegrationTests"

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ To run all tests, execute `npm run test`.
5656
To debug unit tests locally, press <kbd>F5</kbd> in VS Code with the "Launch Tests" debug configuration selected.
5757

5858
To debug integration tests
59-
1. Import the `csharp-standalone-profile.code-profile` in VSCode to setup a clean profile in which to run integration tests. This must be imported at least once to use the launch configurations.
59+
1. Import the `csharp-test-profile.code-profile` in VSCode to setup a clean profile in which to run integration tests. This must be imported at least once to use the launch configurations (ensure the extensions are updated in the profile).
6060
2. Open any integration test file and <kbd>F5</kbd> launch with the correct launch configuration selected.
61-
- For integration tests inside `test/lsptoolshost`, use `Launch Current File slnWithCsproj Integration Tests`
61+
- For integration tests inside `test/lsptoolshost`, use either `Launch Current File slnWithCsproj Integration Tests` or `[DevKit] Launch Current File slnWithCsproj Integration Tests` (to run tests using C# + C# Dev Kit)
6262
- For integration tests inside `test/razor`, use `Launch Current File BasicRazorApp2_1 Integration Tests`
6363
- For integration tests inside `test/omnisharp`, use one of the `Omnisharp:` current file profiles
6464

azure-pipelines.yml

+37-40
Original file line numberDiff line numberDiff line change
@@ -24,58 +24,55 @@ stages:
2424
isOfficial: false
2525
signType: test
2626

27-
- stage: Test_Linux_Stage
28-
displayName: Test Linux
27+
- stage:
28+
displayName: Test Linux (.NET 6)
2929
dependsOn: []
3030
jobs:
31-
- job: Test_Linux_Job
32-
displayName: Test Linux
33-
strategy:
34-
matrix:
35-
DotNet6:
36-
containerName: mcr.microsoft.com/dotnet/sdk:6.0
37-
DotNet7:
38-
containerName: mcr.microsoft.com/dotnet/sdk:7.0
39-
DotNet8:
40-
containerName: mcr.microsoft.com/dotnet/sdk:8.0
41-
pool:
42-
name: NetCore-Public
43-
demands: ImageOverride -equals 1es-ubuntu-2004-open
44-
container: $[ variables['containerName'] ]
45-
steps:
46-
- template: azure-pipelines/test.yml
47-
parameters:
48-
# Prefer the dotnet from the container.
49-
installDotNet: false
50-
installAdditionalLinuxDependencies: true
31+
- template: azure-pipelines/test-matrix.yml
32+
parameters:
33+
# Prefer the dotnet from the container.
34+
installDotNet: false
35+
installAdditionalLinuxDependencies: true
36+
pool:
37+
name: NetCore-Public
38+
demands: ImageOverride -equals 1es-ubuntu-2004-open
39+
containerName: mcr.microsoft.com/dotnet/sdk:6.0
40+
41+
- stage:
42+
displayName: Test Linux (.NET 8)
43+
dependsOn: []
44+
jobs:
45+
- template: azure-pipelines/test-matrix.yml
46+
parameters:
47+
# Prefer the dotnet from the container.
48+
installDotNet: false
49+
installAdditionalLinuxDependencies: true
50+
pool:
51+
name: NetCore-Public
52+
demands: ImageOverride -equals 1es-ubuntu-2004-open
53+
containerName: mcr.microsoft.com/dotnet/sdk:8.0
5154

5255
- stage: Test_Windows_Stage
5356
displayName: Test Windows
5457
dependsOn: []
5558
jobs:
56-
- job: Test_Windows_Job
57-
displayName: Test Windows
58-
pool:
59-
name: NetCore-Public
60-
demands: ImageOverride -equals 1es-windows-2022-open
61-
steps:
62-
- template: azure-pipelines/test.yml
63-
parameters:
64-
installDotNet: true
59+
- template: azure-pipelines/test-matrix.yml
60+
parameters:
61+
installDotNet: true
62+
pool:
63+
name: NetCore-Public
64+
demands: ImageOverride -equals 1es-windows-2022-open
6565

6666
- stage: Test_MacOS_Stage
6767
displayName: Test MacOS
6868
dependsOn: []
6969
jobs:
70-
- job: Test_MacOS_Job
71-
displayName: Test MacOS
72-
pool:
73-
name: Azure Pipelines
74-
vmImage: macOS-13
75-
steps:
76-
- template: azure-pipelines/test.yml
77-
parameters:
78-
installDotNet: true
70+
- template: azure-pipelines/test-matrix.yml
71+
parameters:
72+
installDotNet: true
73+
pool:
74+
name: Azure Pipelines
75+
vmImage: macOS-13
7976

8077
- stage: Test_OmniSharp
8178
displayName: Test OmniSharp

azure-pipelines/test-matrix.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
parameters:
2+
- name: pool
3+
type: object
4+
- name: containerName
5+
type: string
6+
default: ''
7+
- name: installDotNet
8+
type: boolean
9+
- name: installAdditionalLinuxDependencies
10+
type: boolean
11+
default: false
12+
13+
jobs:
14+
- job:
15+
strategy:
16+
matrix:
17+
CSharpTests:
18+
npmCommand: 'test:withoutDevKit'
19+
DevKitTests:
20+
npmCommand: test:integration:devkit
21+
pool: ${{ parameters.pool }}
22+
${{ if parameters.containerName }}:
23+
container: ${{ parameters.containerName }}
24+
steps:
25+
- template: /azure-pipelines/test.yml@self
26+
parameters:
27+
# Prefer the dotnet from the container.
28+
installDotNet: false
29+
installAdditionalLinuxDependencies: true
30+
npmCommand: $(npmCommand)

azure-pipelines/test.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ parameters:
44
- name: installAdditionalLinuxDependencies
55
type: boolean
66
default: false
7+
- name: npmCommand
8+
type: string
79

810
steps:
911
- checkout: self
@@ -23,8 +25,8 @@ steps:
2325
parameters:
2426
installAdditionalLinuxDependencies: ${{ parameters.installAdditionalLinuxDependencies }}
2527

26-
- script: npm run test
27-
displayName: 🧪 Run unit and integration tests
28+
- script: npm run ${{ parameters.npmCommand }}
29+
displayName: 🧪 Run $(Agent.JobName)
2830
env:
2931
DISPLAY: :99.0
3032

@@ -37,11 +39,11 @@ steps:
3739
searchFolder: '$(Build.SourcesDirectory)/out'
3840
publishRunAttachments: true
3941
mergeTestResults: true
40-
testRunTitle: $(Agent.JobName) (Attempt $(System.JobAttempt))
42+
testRunTitle: $(System.StageDisplayName) $(Agent.JobName) (Attempt $(System.JobAttempt))
4143

4244
- task: PublishPipelineArtifact@1
4345
condition: failed()
4446
displayName: 'Upload integration test logs'
4547
inputs:
46-
targetPath: '$(Build.SourcesDirectory)/.vscode-test/user-data/logs'
47-
artifactName: 'VSCode Test Logs ($(Agent.JobName)-$(System.JobAttempt))'
48+
targetPath: '$(Build.SourcesDirectory)/out/logs'
49+
artifactName: 'Test Logs ($(System.StageDisplayName)-$(Agent.JobName)-$(System.JobAttempt))'

jest.config.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ const config: Config = {
2727
// Azure DevOps does not display test suites (it ignores them entirely).
2828
// So we have to put all the info in the test case name so the UI shows anything relatively useful.
2929
// See https://github.com/microsoft/azure-pipelines-tasks/issues/7659
30-
titleTemplate: '{filename} / {suitename} / {title}',
30+
classNameTemplate: '{suitename}',
31+
titleTemplate: `${process.env.JEST_SUITE_NAME} {suitename} / {title}`,
3132
},
3233
],
3334
],

package-lock.json

+26-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@
6767
"compileDev": "tsc -p ./ && npx eslint ./ && webpack --mode development && npm run l10nDevGenerateLocalizationBundle",
6868
"watch": "tsc -watch -p ./",
6969
"test": "tsc -p ./ && gulp test",
70-
"test:integration": "tsc -p ./ && gulp test:integration",
70+
"test:withoutDevKit": "tsc -p ./ && gulp test:withoutDevKit",
71+
"test:integration:devkit": "tsc -p ./ && gulp test:integration:devkit",
7172
"test:razor": "tsc -p ./ && npm run compile:razorTextMate && gulp test:razor",
7273
"test:razorintegration": "tsc -p ./ && gulp test:razorintegration",
7374
"test:artifacts": "tsc -p ./ && gulp test:artifacts",
@@ -126,7 +127,7 @@
126127
"@types/fs-extra": "5.0.4",
127128
"@types/gulp": "4.0.5",
128129
"@types/minimist": "1.2.1",
129-
"@types/node": "16.11.38",
130+
"@types/node": "20.14.8",
130131
"@types/semver": "7.3.13",
131132
"@types/tmp": "0.0.33",
132133
"@types/unzipper": "^0.9.1",

src/omnisharp/features/dotnetTest.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const TelemetryReportingDelay = 2 * 60 * 1000; // two minutes
4141
export default class TestManager extends AbstractProvider {
4242
private _runCounts?: { [testFrameworkName: string]: number };
4343
private _debugCounts?: { [testFrameworkName: string]: number };
44-
private _telemetryIntervalId?: NodeJS.Timer = undefined;
44+
private _telemetryIntervalId?: NodeJS.Timeout = undefined;
4545
private _eventStream: EventStream;
4646

4747
constructor(

src/packageManager/zipInstaller.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ export async function InstallZip(
4343
} catch (err) {
4444
const error = err as NodeJS.ErrnoException; // Hack for TypeScript to type err correctly
4545
return reject(
46-
new NestedError(
47-
'Error creating directory for zip directory entry:' + error.code ?? '',
48-
error
49-
)
46+
new NestedError('Error creating directory for zip directory entry:' + error.code, error)
5047
);
5148
}
5249
} else {

src/razor/src/document/razorDocumentSynchronizer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ interface SynchronizationContext {
256256
readonly projectedDocument: IProjectedDocument;
257257
readonly logIdentifier: number;
258258
readonly toHostDocumentVersion: number;
259-
readonly timeoutId: NodeJS.Timer;
259+
readonly timeoutId: NodeJS.Timeout;
260260
readonly projectedDocumentSynchronized: () => void;
261261
readonly onProjectedDocumentSynchronized: Promise<void>;
262262
readonly projectedTextDocumentSynchronized: () => void;

src/razor/src/html/htmlTagCompletionProvider.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { RazorLanguageServiceClient } from '../razorLanguageServiceClient';
1515
import { LanguageKind } from '../rpc/languageKind';
1616

1717
export class HtmlTagCompletionProvider {
18-
private timeout: NodeJS.Timer | undefined = void 0;
18+
private timeout: NodeJS.Timeout | undefined = void 0;
1919
private enabled = false;
2020
private htmlLanguageService: HtmlLanguageService | undefined;
2121

0 commit comments

Comments
 (0)