Skip to content

Commit e164687

Browse files
Convert doVariantAnalysisTest to take multiple queries
1 parent 70b8ddf commit e164687

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

extensions/ql-vscode/test/vscode-tests/cli-integration/variant-analysis/variant-analysis-manager.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ describe("Variant Analysis Manager", () => {
236236

237237
it("should run a remote query that is part of a qlpack", async () => {
238238
await doVariantAnalysisTest({
239-
queryPath: "data-remote-qlpack/in-pack.ql",
239+
queryPaths: ["data-remote-qlpack/in-pack.ql"],
240240
qlPackRootPath: "data-remote-qlpack",
241241
qlPackFilePath: "data-remote-qlpack/qlpack.yml",
242242
expectedPackName: "github/remote-query-pack",
@@ -248,7 +248,7 @@ describe("Variant Analysis Manager", () => {
248248

249249
it("should run a remote query that is not part of a qlpack", async () => {
250250
await doVariantAnalysisTest({
251-
queryPath: "data-remote-no-qlpack/in-pack.ql",
251+
queryPaths: ["data-remote-no-qlpack/in-pack.ql"],
252252
qlPackRootPath: "data-remote-no-qlpack",
253253
qlPackFilePath: undefined,
254254
expectedPackName: "codeql-remote/query",
@@ -260,7 +260,7 @@ describe("Variant Analysis Manager", () => {
260260

261261
it("should run a remote query that is nested inside a qlpack", async () => {
262262
await doVariantAnalysisTest({
263-
queryPath: "data-remote-qlpack-nested/subfolder/in-pack.ql",
263+
queryPaths: ["data-remote-qlpack-nested/subfolder/in-pack.ql"],
264264
qlPackRootPath: "data-remote-qlpack-nested",
265265
qlPackFilePath: "data-remote-qlpack-nested/codeql-pack.yml",
266266
expectedPackName: "github/remote-query-pack",
@@ -279,7 +279,7 @@ describe("Variant Analysis Manager", () => {
279279
}
280280
await cli.setUseExtensionPacks(true);
281281
await doVariantAnalysisTest({
282-
queryPath: "data-remote-qlpack-nested/subfolder/in-pack.ql",
282+
queryPaths: ["data-remote-qlpack-nested/subfolder/in-pack.ql"],
283283
qlPackRootPath: "data-remote-qlpack-nested",
284284
qlPackFilePath: "data-remote-qlpack-nested/codeql-pack.yml",
285285
expectedPackName: "github/remote-query-pack",
@@ -330,7 +330,7 @@ describe("Variant Analysis Manager", () => {
330330
const queryPath = join(qlPackRootPath, queryToRun);
331331
const qlPackFilePath = join(qlPackRootPath, "qlpack.yml");
332332
await doVariantAnalysisTest({
333-
queryPath,
333+
queryPaths: [queryPath],
334334
qlPackRootPath,
335335
qlPackFilePath,
336336
expectedPackName: "codeql/java-queries",
@@ -344,7 +344,7 @@ describe("Variant Analysis Manager", () => {
344344
});
345345

346346
async function doVariantAnalysisTest({
347-
queryPath,
347+
queryPaths,
348348
qlPackRootPath,
349349
qlPackFilePath,
350350
expectedPackName,
@@ -357,7 +357,7 @@ describe("Variant Analysis Manager", () => {
357357
dependenciesToCheck = ["codeql/javascript-all"],
358358
checkVersion = true,
359359
}: {
360-
queryPath: string;
360+
queryPaths: string[];
361361
qlPackRootPath: string;
362362
qlPackFilePath: string | undefined;
363363
expectedPackName: string;
@@ -367,9 +367,9 @@ describe("Variant Analysis Manager", () => {
367367
dependenciesToCheck?: string[];
368368
checkVersion?: boolean;
369369
}) {
370-
const filePath = getFileOrDir(queryPath);
370+
const filePaths = queryPaths.map(getFileOrDir);
371371
const qlPackDetails: QlPackDetails = {
372-
queryFiles: [filePath],
372+
queryFiles: filePaths,
373373
qlPackRootPath: getFileOrDir(qlPackRootPath),
374374
qlPackFilePath: qlPackFilePath && getFileOrDir(qlPackFilePath),
375375
language: QueryLanguage.Javascript,
@@ -385,7 +385,7 @@ describe("Variant Analysis Manager", () => {
385385
expect(executeCommandSpy).toHaveBeenCalledWith(
386386
"codeQL.monitorNewVariantAnalysis",
387387
expect.objectContaining({
388-
query: expect.objectContaining({ filePath }),
388+
query: expect.objectContaining({ filePath: filePaths[0] }),
389389
}),
390390
);
391391

0 commit comments

Comments
 (0)