Skip to content

Commit 0eed89b

Browse files
authored
Merge pull request #7560 from dibarbet/devkit_integration_tests
Update integration tests to also run against C# Dev Kit
2 parents 1644291 + 1426bf4 commit 0eed89b

File tree

73 files changed

+1064
-1385
lines changed

Some content is hidden

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

73 files changed

+1064
-1385
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = {
2121
rules: {
2222
"@typescript-eslint/no-explicit-any": "off",
2323
"@typescript-eslint/no-non-null-assertion": "off",
24-
"@typescript-eslint/semi": ["error", "always"],
24+
"@typescript-eslint/no-require-imports": "off",
2525
// Allow unused vars if prefixed by _
2626
"@typescript-eslint/no-unused-vars": [
2727
"warn",

.vscode/launch.json

Lines changed: 34 additions & 9 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 37 additions & 40 deletions
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

Lines changed: 30 additions & 0 deletions
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

Lines changed: 7 additions & 5 deletions
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

Lines changed: 2 additions & 1 deletion
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
],

0 commit comments

Comments
 (0)