Skip to content

Commit b7489d8

Browse files
Merge pull request #1400 from github/elenatanasoiu/check-for-codeql-folder-in-workspace
Fail fast if codeql repo is missing from the workspace
2 parents c84b858 + e0b2aa9 commit b7489d8

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,11 @@ Running from a terminal, you _must_ set the `TEST_CODEQL_PATH` variable to point
9595

9696
### Running the integration tests
9797

98-
The _Launch Integration Tests - With CLI_ tests require a CLI instance in order to run. There are several environment variables you can use to configure this.
98+
You will need to run CLI tests using a task from inside of VS Code called _Launch Integration Tests - With CLI_.
9999

100-
From inside of VSCode, open the `launch.json` file and in the _Launch Integration Tests - With CLI_ uncomment and change the environment variables appropriate for your purpose.
100+
The CLI integration tests require the CodeQL standard libraries in order to run so you will need to clone a local copy of the `github/codeql` repository.
101+
102+
From inside of VSCode, open the `launch.json` file and in the _Launch Integration Tests - With CLI_ task, uncomment the `"${workspaceRoot}/../codeql"` line. If necessary, replace value with a path to your checkout, and then run the task.
101103

102104
## Releasing (write access required)
103105

extensions/ql-vscode/src/vscode-tests/cli-integration/global.helper.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export default function(mocha: Mocha) {
7575
}
7676
);
7777

78-
// ensure etension is cleaned up.
78+
// ensure extension is cleaned up.
7979
(mocha.options as any).globalTeardown.push(
8080
async () => {
8181
const extension = await extensions.getExtension<CodeQLExtensionInterface | Record<string, never>>('GitHub.vscode-codeql')!.activate();
@@ -93,6 +93,21 @@ export default function(mocha: Mocha) {
9393
removeStorage?.();
9494
}
9595
);
96+
97+
// check that the codeql folder is found in the workspace
98+
(mocha.options as any).globalSetup.push(
99+
async () => {
100+
const folders = workspace.workspaceFolders;
101+
if (!folders) {
102+
fail('\n\n\nNo workspace folders found.\nYou will need a local copy of the codeql repo.\nMake sure you specify the path to it in launch.json.\nIt should be something along the lines of "${workspaceRoot}/../codeql" depending on where you have your local copy of the codeql repo.\n\n\n');
103+
} else {
104+
const codeqlFolder = folders.find(folder => folder.name === 'codeql');
105+
if (!codeqlFolder) {
106+
fail('\n\n\nNo workspace folders found.\nYou will need a local copy of the codeql repo.\nMake sure you specify the path to it in launch.json.\nIt should be something along the lines of "${workspaceRoot}/../codeql" depending on where you have your local copy of the codeql repo.\n\n\n');
107+
}
108+
}
109+
}
110+
);
96111
}
97112

98113
export async function cleanDatabases(databaseManager: DatabaseManager) {

0 commit comments

Comments
 (0)