Skip to content

Commit

Permalink
Clarify how to run CLI tests locally
Browse files Browse the repository at this point in the history
Also, remove an errant `only`, which was preventing some tests from
running.
  • Loading branch information
aeisenberg committed Jan 20, 2021
1 parent 9c72e81 commit 044bc30
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@
"--extensionDevelopmentPath=${workspaceRoot}/extensions/ql-vscode",
"--extensionTestsPath=${workspaceRoot}/extensions/ql-vscode/out/vscode-tests/cli-integration/index",
"${workspaceRoot}/extensions/ql-vscode/src/vscode-tests/cli-integration/data",
// Add a path to a checked out instance of the codeql repository so the libraries are
// available in the workspace for the tests.
// "${workspaceRoot}/../codeql"
],
"stopOnEntry": false,
"sourceMaps": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Use cli', function() {
]);
});

it.only('should resolve query packs', async function() {
it('should resolve query packs', async function() {
skipIfNoCodeQL(this);
const qlpacks = await cli.resolveQlpacks(getOnDiskWorkspaceFolders());
// should have a bunch of qlpacks. just check that a few known ones exist
Expand Down
8 changes: 6 additions & 2 deletions extensions/ql-vscode/src/vscode-tests/ensureCli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export async function ensureCli(useCli: boolean) {
console.log('Total content size', Math.round(contentLength / _1MB), 'MB');
const archiveFile = fs.createWriteStream(downloadedFilePath);
const body = assetStream.body;
await new Promise((resolve, reject) => {
await new Promise<void>((resolve, reject) => {
let numBytesDownloaded = 0;
let lastMessage = 0;
body.on('data', (data) => {
Expand Down Expand Up @@ -117,7 +117,11 @@ function hasCodeQL() {

export function skipIfNoCodeQL(context: Mocha.Context) {
if (!hasCodeQL()) {
console.log('The CodeQL libraries are not available as a folder in this workspace. To fix: checkout the github/codeql repository and set the TEST_CODEQL_PATH environment variable to the checked out directory.');
console.log([
'The CodeQL libraries are not available as a folder in this workspace.',
'To fix in CI: checkout the github/codeql repository and set the \'TEST_CODEQL_PATH\' environment variable to the checked out directory.',
'To fix when running from vs code, see the comment in the launch.json file in the \'Launch Integration Tests - With CLI\' section.'
].join('\n\n'));
context.skip();
}
}
Expand Down

0 comments on commit 044bc30

Please sign in to comment.