Clarify how to run CLI tests locally

Also, remove an errant `only`, which was preventing some tests from
running.
This commit is contained in:
Andrew Eisenberg
2021-01-20 09:14:01 -08:00
parent 9c72e81264
commit 044bc30d96
3 changed files with 10 additions and 3 deletions

3
.vscode/launch.json vendored
View File

@@ -89,6 +89,9 @@
"--extensionDevelopmentPath=${workspaceRoot}/extensions/ql-vscode", "--extensionDevelopmentPath=${workspaceRoot}/extensions/ql-vscode",
"--extensionTestsPath=${workspaceRoot}/extensions/ql-vscode/out/vscode-tests/cli-integration/index", "--extensionTestsPath=${workspaceRoot}/extensions/ql-vscode/out/vscode-tests/cli-integration/index",
"${workspaceRoot}/extensions/ql-vscode/src/vscode-tests/cli-integration/data", "${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, "stopOnEntry": false,
"sourceMaps": true, "sourceMaps": true,

View File

@@ -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); skipIfNoCodeQL(this);
const qlpacks = await cli.resolveQlpacks(getOnDiskWorkspaceFolders()); const qlpacks = await cli.resolveQlpacks(getOnDiskWorkspaceFolders());
// should have a bunch of qlpacks. just check that a few known ones exist // should have a bunch of qlpacks. just check that a few known ones exist

View File

@@ -72,7 +72,7 @@ export async function ensureCli(useCli: boolean) {
console.log('Total content size', Math.round(contentLength / _1MB), 'MB'); console.log('Total content size', Math.round(contentLength / _1MB), 'MB');
const archiveFile = fs.createWriteStream(downloadedFilePath); const archiveFile = fs.createWriteStream(downloadedFilePath);
const body = assetStream.body; const body = assetStream.body;
await new Promise((resolve, reject) => { await new Promise<void>((resolve, reject) => {
let numBytesDownloaded = 0; let numBytesDownloaded = 0;
let lastMessage = 0; let lastMessage = 0;
body.on('data', (data) => { body.on('data', (data) => {
@@ -117,7 +117,11 @@ function hasCodeQL() {
export function skipIfNoCodeQL(context: Mocha.Context) { export function skipIfNoCodeQL(context: Mocha.Context) {
if (!hasCodeQL()) { 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(); context.skip();
} }
} }