Skip to content

Commit 256b806

Browse files
committed
Remove skipIfTrue
Also, add a comment to the vscode settings file and describe how to use it.
1 parent c0c30b4 commit 256b806

3 files changed

Lines changed: 26 additions & 12 deletions

File tree

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
"LANG": "en-US",
4343
"TZ": "UTC"
4444
},
45+
46+
// These options are used by the `jestrunner.debug` command.
47+
// They are not used by the `jestrunner.run` command.
4548
"jestrunner.debugOptions": {
4649
// Uncomment to debug integration tests
4750
// "attachSimplePort": 9223,

extensions/ql-vscode/test/vscode-tests/cli-integration/queries.test.ts

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import { DatabaseItem, DatabaseManager } from "../../../src/databases";
1919
import { CodeQLExtensionInterface } from "../../../src/extension";
2020
import { cleanDatabases, dbLoc, storagePath } from "./global.helper";
2121
import { importArchiveDatabase } from "../../../src/databaseFetcher";
22-
import { CodeQLCliServer } from "../../../src/cli";
23-
import { describeWithCodeQL, skipIfTrue } from "../cli";
22+
import { CliVersionConstraint, CodeQLCliServer } from "../../../src/cli";
23+
import { describeWithCodeQL } from "../cli";
2424
import { tmpDir } from "../../../src/helpers";
2525
import { createInitialQueryInfo } from "../../../src/run-queries-shared";
2626
import { QueryRunner } from "../../../src/queryRunner";
@@ -99,8 +99,6 @@ describeWithCodeQL()("Queries", () => {
9999
});
100100

101101
describe("extension packs", () => {
102-
skipIfTrue(qs.cliServer.cliConstraints.supportsQlpacksKind);
103-
104102
const queryUsingExtensionPath = join(
105103
__dirname,
106104
"../..",
@@ -110,17 +108,38 @@ describeWithCodeQL()("Queries", () => {
110108
);
111109

112110
it("should run a query that has an extension without looking for extensions in the workspace", async () => {
111+
if (!(await supportsExtensionPacks())) {
112+
console.log(
113+
`Skipping test because it is only supported for CodeQL CLI versions < ${CliVersionConstraint.CLI_VERSION_WITH_QLPACKS_KIND}`,
114+
);
115+
return;
116+
}
117+
113118
await cli.setUseExtensionPacks(false);
114119
const parsedResults = await runQueryWithExtensions();
115120
expect(parsedResults).toEqual([1]);
116121
});
117122

118123
it("should run a query that has an extension and look for extensions in the workspace", async () => {
124+
if (!(await supportsExtensionPacks())) {
125+
return;
126+
}
127+
119128
await cli.setUseExtensionPacks(true);
120129
const parsedResults = await runQueryWithExtensions();
121130
expect(parsedResults).toEqual([1, 2, 3, 4]);
122131
});
123132

133+
async function supportsExtensionPacks(): Promise<boolean> {
134+
if (await qs.cliServer.cliConstraints.supportsQlpacksKind()) {
135+
return true;
136+
}
137+
console.log(
138+
`Skipping test because it is only supported for CodeQL CLI versions < ${CliVersionConstraint.CLI_VERSION_WITH_QLPACKS_KIND}`,
139+
);
140+
return false;
141+
}
142+
124143
async function runQueryWithExtensions() {
125144
const result = new CompletedQueryInfo(
126145
await qs.compileAndRunQueryAgainstDatabase(

extensions/ql-vscode/test/vscode-tests/cli.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,3 @@ export function itWithCodeQL() {
4242

4343
return it;
4444
}
45-
46-
export function skipIfTrue(condition: () => Thenable<boolean>) {
47-
return beforeEach(async () => {
48-
if (await condition) {
49-
pending();
50-
}
51-
});
52-
}

0 commit comments

Comments
 (0)