Skip to content

Commit 6d86e5b

Browse files
committed
Run a build before the integration tests instead of as part of the specific source generator test.
1 parent 87d3c66 commit 6d86e5b

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

test/integrationTests/definitionProvider.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import * as path from "path";
99
import testAssetWorkspace from "./testAssets/testAssetWorkspace";
1010
import { expect } from "chai";
1111
import { activateCSharpExtension, isRazorWorkspace, isSlnWithCsproj, restartOmniSharpServer } from './integrationHelpers';
12-
import { assertWithPoll, sleep } from "./poll";
12+
import { assertWithPoll } from "./poll";
1313

1414
suite(`${CSharpDefinitionProvider.name}: ${testAssetWorkspace.description}`, () => {
1515
let fileUri: vscode.Uri;
@@ -70,14 +70,14 @@ suite(`${CSharpDefinitionProvider.name}: ${testAssetWorkspace.description}`, ()
7070
const textStart = new vscode.Position(11, 41);
7171
await vscode.commands.executeCommand('vscode.open', generatorTriggerUri);
7272

73-
// We need to do a full build in order to get the source generator built and ready to run, or tests will fail
74-
await vscode.commands.executeCommand("dotnet.generateAssets", 0);
75-
await sleep(100);
76-
const tasks = await vscode.tasks.fetchTasks();
77-
const task = (tasks).filter(task => task.name === 'build')[0];
78-
expect(task).to.not.be.undefined;
79-
await vscode.tasks.executeTask(task);
80-
await restartOmniSharpServer();
73+
// // We need to do a full build in order to get the source generator built and ready to run, or tests will fail
74+
// await vscode.commands.executeCommand("dotnet.generateAssets", 0);
75+
// await sleep(100);
76+
// const tasks = await vscode.tasks.fetchTasks();
77+
// const task = (tasks).filter(task => task.name === 'build')[0];
78+
// expect(task).to.not.be.undefined;
79+
// await vscode.tasks.executeTask(task);
80+
// await restartOmniSharpServer();
8181

8282
const definitionList = <vscode.Location[]>(await vscode.commands.executeCommand("vscode.executeDefinitionProvider", generatorTriggerUri, textStart));
8383
expect(definitionList.length).to.be.equal(1);

test/runIntegrationTests.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import * as path from 'path';
77

88
import { runTests } from 'vscode-test';
9+
import { execChildProcess } from '../src/common';
910

1011
async function main() {
1112
try {
@@ -18,11 +19,19 @@ async function main() {
1819
const extensionTestsPath = path.resolve(__dirname, './integrationTests/index');
1920

2021
// The integration tests expect that the workspace to run the
21-
// tests against is set in an evironment variable.
22+
// tests against is set in an environment variable.
2223
const workspacePath = process.env.CODE_TESTS_WORKSPACE;
2324

25+
if (!workspacePath) {
26+
console.error(`Empty workspace path`);
27+
process.exit(-1);
28+
}
29+
2430
console.log(`workspace path = '${workspacePath}'`);
2531

32+
// Run a build before the tests, to ensure that source generators are set up correctly
33+
await execChildProcess(`dotnet build`, workspacePath);
34+
2635
// Download VS Code, unzip it and run the integration test
2736
await runTests({ extensionDevelopmentPath, extensionTestsPath, launchArgs: [workspacePath, '-n', '--verbose'], extensionTestsEnv: process.env });
2837
} catch (err) {
@@ -32,4 +41,4 @@ async function main() {
3241
}
3342
}
3443

35-
main();
44+
main();

0 commit comments

Comments
 (0)