Skip to content

Commit 514b138

Browse files
committed
Run all Razor tests with cohosting on
1 parent 6e2f074 commit 514b138

File tree

10 files changed

+68
-11
lines changed

10 files changed

+68
-11
lines changed

.vscode/launch.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,33 @@
9292
"preLaunchTask": "packageDev",
9393
"internalConsoleOptions": "openOnSessionStart"
9494
},
95+
{
96+
"name": "[Razor Cohost] Run Current File Integration Test",
97+
"type": "extensionHost",
98+
"request": "launch",
99+
"runtimeExecutable": "${execPath}",
100+
"args": [
101+
// Launch VSCode using a specific profile to ensure that user settings are not used.
102+
// This profile must be imported into vscode before running this launch configuration.
103+
// The profile can be found under /test/csharp-test-profile.
104+
"--profile",
105+
"csharp-test-profile",
106+
"${workspaceRoot}/test/razor/razorIntegrationTests/testAssets/RazorApp/.vscode/RazorApp.code-workspace",
107+
"--extensionDevelopmentPath=${workspaceRoot}",
108+
"--extensionTestsPath=${workspaceRoot}/out/test/razor/razorIntegrationTests",
109+
"--log",
110+
"ms-dotnettools.csharp:trace"
111+
],
112+
"env": {
113+
"CODE_EXTENSIONS_PATH": "${workspaceRoot}",
114+
"TEST_FILE_FILTER": "${file}"
115+
},
116+
"sourceMaps": true,
117+
"outFiles": ["${workspaceRoot}/dist/*.js", "${workspaceRoot}/out/test/**/*.js"],
118+
"resolveSourceMapLocations": ["${workspaceFolder}/**", "!**/node_modules/**"],
119+
"preLaunchTask": "packageDev",
120+
"internalConsoleOptions": "openOnSessionStart"
121+
},
95122
{
96123
"name": "[O#] Run Current File Integration Tests",
97124
"type": "extensionHost",
@@ -197,6 +224,15 @@
197224
"program": "${workspaceFolder}/node_modules/gulp/bin/gulp.js",
198225
"args": ["test:integration:razor"],
199226
"cwd": "${workspaceFolder}"
227+
},
228+
{
229+
"type": "node",
230+
"request": "launch",
231+
"name": "Razor Cohost integration tests",
232+
"preLaunchTask": "build",
233+
"program": "${workspaceFolder}/node_modules/gulp/bin/gulp.js",
234+
"args": ["test:integration:razor:cohost"],
235+
"cwd": "${workspaceFolder}"
200236
}
201237
],
202238
"inputs": [

azure-pipelines/test-matrix.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ jobs:
2828
RazorTests:
2929
npmCommand: test:integration:razor
3030
isIntegration: true
31+
RazorCohostTests:
32+
npmCommand: test:integration:razor:cohost
33+
isIntegration: true
3134
pool: ${{ parameters.pool }}
3235
${{ if parameters.containerName }}:
3336
container: ${{ parameters.containerName }}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
"test:unit": "npm run compileDev && gulp test:unit",
7474
"test:integration:csharp": "npm run package && gulp test:integration:csharp",
7575
"test:integration:razor": "npm run package && gulp test:integration:razor",
76+
"test:integration:razor:cohost": "npm run package && gulp test:integration:razor:cohost",
7677
"test:integration:devkit": "npm run package && gulp test:integration:devkit",
7778
"profiling": "npm run package && gulp profiling",
7879
"test:artifacts": "npm run compileDev && gulp test:artifacts",

tasks/testTasks.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,27 @@ function createIntegrationTestSubTasks() {
8585
`Razor Test Integration ${projectName}`
8686
)
8787
);
88+
89+
gulp.task(`test:integration:razor:cohost:${projectName}`, async () =>
90+
// Register each test again, but as a regular test, which will run with cohosting on
91+
runIntegrationTest(
92+
projectName,
93+
path.join('razor', 'razorIntegrationTests'),
94+
`Razor Test Integration ${projectName}`
95+
)
96+
);
8897
}
8998

9099
gulp.task(
91100
'test:integration:razor',
92101
gulp.series(razorIntegrationTestProjects.map((projectName) => `test:integration:razor:${projectName}`))
93102
);
94103

104+
gulp.task(
105+
'test:integration:razor:cohost',
106+
gulp.series(razorIntegrationTestProjects.map((projectName) => `test:integration:razor:cohost:${projectName}`))
107+
);
108+
95109
gulp.task(
96110
'test:integration',
97111
gulp.series('test:integration:csharp', 'test:integration:devkit', 'test:integration:razor')

test/razor/razorIntegrationTests/completion.integration.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
import * as path from 'path';
77
import * as vscode from 'vscode';
8-
import { beforeAll, afterAll, test, expect, beforeEach } from '@jest/globals';
8+
import { beforeAll, afterAll, test, expect, beforeEach, describe } from '@jest/globals';
99
import testAssetWorkspace from './testAssets/testAssetWorkspace';
1010
import * as integrationHelpers from '../../lsptoolshost/integrationTests/integrationHelpers';
1111

12-
integrationHelpers.describeIfDevKit(`Razor Hover ${testAssetWorkspace.description}`, function () {
12+
describe(`Razor Hover ${testAssetWorkspace.description}`, function () {
1313
beforeAll(async function () {
1414
if (!integrationHelpers.isRazorWorkspace(vscode.workspace)) {
1515
return;

test/razor/razorIntegrationTests/formatting.integration.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
import * as path from 'path';
77
import * as vscode from 'vscode';
8-
import { beforeAll, afterAll, test, expect, beforeEach } from '@jest/globals';
8+
import { beforeAll, afterAll, test, expect, beforeEach, describe } from '@jest/globals';
99
import testAssetWorkspace from './testAssets/testAssetWorkspace';
1010
import * as integrationHelpers from '../../lsptoolshost/integrationTests/integrationHelpers';
1111

12-
integrationHelpers.describeIfDevKit(`Razor Formatting ${testAssetWorkspace.description}`, function () {
12+
describe(`Razor Formatting ${testAssetWorkspace.description}`, function () {
1313
beforeAll(async function () {
1414
if (!integrationHelpers.isRazorWorkspace(vscode.workspace)) {
1515
return;

test/razor/razorIntegrationTests/hover.integration.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
import * as path from 'path';
77
import * as vscode from 'vscode';
8-
import { beforeAll, afterAll, test, expect, beforeEach } from '@jest/globals';
8+
import { beforeAll, afterAll, test, expect, beforeEach, describe } from '@jest/globals';
99
import testAssetWorkspace from './testAssets/testAssetWorkspace';
1010
import * as integrationHelpers from '../../lsptoolshost/integrationTests/integrationHelpers';
1111

12-
integrationHelpers.describeIfDevKit(`Razor Hover ${testAssetWorkspace.description}`, function () {
12+
describe(`Razor Hover ${testAssetWorkspace.description}`, function () {
1313
beforeAll(async function () {
1414
if (!integrationHelpers.isRazorWorkspace(vscode.workspace)) {
1515
return;

test/razor/razorIntegrationTests/reference.integration.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
import * as path from 'path';
77
import * as vscode from 'vscode';
8-
import { beforeAll, afterAll, test, expect, beforeEach } from '@jest/globals';
8+
import { beforeAll, afterAll, test, expect, beforeEach, describe } from '@jest/globals';
99
import testAssetWorkspace from './testAssets/testAssetWorkspace';
1010
import * as integrationHelpers from '../../lsptoolshost/integrationTests/integrationHelpers';
1111

12-
integrationHelpers.describeIfDevKit(`Razor References ${testAssetWorkspace.description}`, function () {
12+
describe(`Razor References ${testAssetWorkspace.description}`, function () {
1313
beforeAll(async function () {
1414
if (!integrationHelpers.isRazorWorkspace(vscode.workspace)) {
1515
return;

test/razor/razorIntegrationTests/rename.integration.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
import * as path from 'path';
77
import * as vscode from 'vscode';
8-
import { beforeAll, afterAll, test, expect, beforeEach } from '@jest/globals';
8+
import { beforeAll, afterAll, test, expect, beforeEach, describe } from '@jest/globals';
99
import testAssetWorkspace from './testAssets/testAssetWorkspace';
1010
import * as integrationHelpers from '../../lsptoolshost/integrationTests/integrationHelpers';
1111

12-
integrationHelpers.describeIfDevKit(`Razor Rename ${testAssetWorkspace.description}`, function () {
12+
describe(`Razor Rename ${testAssetWorkspace.description}`, function () {
1313
beforeAll(async function () {
1414
if (!integrationHelpers.isRazorWorkspace(vscode.workspace)) {
1515
return;

test/razor/razorIntegrationTests/testAssets/RazorApp/.vscode/RazorApp.code-workspace

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
"dotnet.server.useOmnisharp": false,
1010
"omnisharp.enableLspDriver": false,
1111
"razor.server.trace": "Trace",
12-
"dotnet.preferCSharpExtension": true
12+
"dotnet.preferCSharpExtension": true,
13+
"razor.languageServer.cohostingEnabled": true,
14+
"razor.format.enable": true,
15+
"html.format.enable": true
1316
}
1417
}

0 commit comments

Comments
 (0)