Merge pull request #1400 from github/elenatanasoiu/check-for-codeql-folder-in-workspace

Fail fast if codeql repo is missing from the workspace
This commit is contained in:
Elena Tanasoiu
2022-06-23 09:26:40 +01:00
committed by GitHub
2 changed files with 20 additions and 3 deletions

View File

@@ -95,9 +95,11 @@ Running from a terminal, you _must_ set the `TEST_CODEQL_PATH` variable to point
### Running the integration tests
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.
You will need to run CLI tests using a task from inside of VS Code called _Launch Integration Tests - With CLI_.
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.
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.
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.
## Releasing (write access required)

View File

@@ -75,7 +75,7 @@ export default function(mocha: Mocha) {
}
);
// ensure etension is cleaned up.
// ensure extension is cleaned up.
(mocha.options as any).globalTeardown.push(
async () => {
const extension = await extensions.getExtension<CodeQLExtensionInterface | Record<string, never>>('GitHub.vscode-codeql')!.activate();
@@ -93,6 +93,21 @@ export default function(mocha: Mocha) {
removeStorage?.();
}
);
// check that the codeql folder is found in the workspace
(mocha.options as any).globalSetup.push(
async () => {
const folders = workspace.workspaceFolders;
if (!folders) {
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');
} else {
const codeqlFolder = folders.find(folder => folder.name === 'codeql');
if (!codeqlFolder) {
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');
}
}
}
);
}
export async function cleanDatabases(databaseManager: DatabaseManager) {