Add types to command runners
This commit is contained in:
@@ -16,12 +16,13 @@ import { createRemoteSystemDefinedListDbItem } from "../../../factories/db-item-
|
||||
import { DbConfigStore } from "../../../../src/databases/config/db-config-store";
|
||||
import { getActivatedExtension } from "../../global.helper";
|
||||
import { createVSCodeCommandManager } from "../../../../src/common/vscode/commands";
|
||||
import { AllCommands } from "../../../../src/common/commands";
|
||||
|
||||
jest.setTimeout(60_000);
|
||||
|
||||
describe("Db panel UI commands", () => {
|
||||
let storagePath: string;
|
||||
const commandManager = createVSCodeCommandManager();
|
||||
const commandManager = createVSCodeCommandManager<AllCommands>();
|
||||
|
||||
beforeEach(async () => {
|
||||
const extension = await getActivatedExtension();
|
||||
|
||||
@@ -26,6 +26,7 @@ import { CompletedQueryInfo } from "../../../src/query-results";
|
||||
import { SELECT_QUERY_NAME } from "../../../src/contextual/locationFinder";
|
||||
import { createMockCommandManager } from "../../__mocks__/commandsMock";
|
||||
import { createVSCodeCommandManager } from "../../../src/common/vscode/commands";
|
||||
import { AllCommands, QueryServerCommands } from "../../../src/common/commands";
|
||||
|
||||
jest.setTimeout(20_000);
|
||||
|
||||
@@ -40,7 +41,9 @@ describeWithCodeQL()("Queries", () => {
|
||||
const progress = jest.fn();
|
||||
let token: CancellationToken;
|
||||
let ctx: ExtensionContext;
|
||||
const commandManager = createVSCodeCommandManager();
|
||||
const appCommandManager = createVSCodeCommandManager<AllCommands>();
|
||||
const queryServerCommandManager =
|
||||
createVSCodeCommandManager<QueryServerCommands>();
|
||||
|
||||
let qlpackFile: string;
|
||||
let qlpackLockFile: string;
|
||||
@@ -178,7 +181,7 @@ describeWithCodeQL()("Queries", () => {
|
||||
|
||||
// Asserts a fix for bug https://github.com/github/vscode-codeql/issues/733
|
||||
it("should restart the database and run a query", async () => {
|
||||
await commandManager.execute("codeQL.restartQueryServer");
|
||||
await appCommandManager.execute("codeQL.restartQueryServer");
|
||||
const queryPath = join(__dirname, "data", "simple-query.ql");
|
||||
const result = await qs.compileAndRunQueryAgainstDatabase(
|
||||
dbItem,
|
||||
@@ -192,7 +195,7 @@ describeWithCodeQL()("Queries", () => {
|
||||
});
|
||||
|
||||
it("should create a quick query", async () => {
|
||||
await commandManager.execute("codeQL.quickQuery");
|
||||
await queryServerCommandManager.execute("codeQL.quickQuery");
|
||||
|
||||
// should have created the quick query file and query pack file
|
||||
expect(pathExistsSync(qlFile)).toBe(true);
|
||||
@@ -225,7 +228,7 @@ describeWithCodeQL()("Queries", () => {
|
||||
}),
|
||||
);
|
||||
writeFileSync(qlFile, "xxx");
|
||||
await commandManager.execute("codeQL.quickQuery");
|
||||
await queryServerCommandManager.execute("codeQL.quickQuery");
|
||||
|
||||
// should not have created the quick query file because database schema hasn't changed
|
||||
expect(readFileSync(qlFile, "utf8")).toBe("xxx");
|
||||
|
||||
@@ -3,6 +3,7 @@ import { join, basename } from "path";
|
||||
import { tmpDir } from "../../../src/helpers";
|
||||
import { readFile, writeFile, ensureDir, copy } from "fs-extra";
|
||||
import { createVSCodeCommandManager } from "../../../src/common/vscode/commands";
|
||||
import { AllCommands } from "../../../src/common/commands";
|
||||
|
||||
jest.setTimeout(20_000);
|
||||
|
||||
@@ -10,7 +11,7 @@ jest.setTimeout(20_000);
|
||||
* Integration tests for queries
|
||||
*/
|
||||
describe("SourceMap", () => {
|
||||
const commandManager = createVSCodeCommandManager();
|
||||
const commandManager = createVSCodeCommandManager<AllCommands>();
|
||||
|
||||
it("should jump to QL code", async () => {
|
||||
const root = workspace.workspaceFolders![0].uri.fsPath;
|
||||
|
||||
@@ -13,6 +13,7 @@ import { mockedQuickPickItem } from "../../utils/mocking.helpers";
|
||||
import { setRemoteControllerRepo } from "../../../../src/config";
|
||||
import { getActivatedExtension } from "../../global.helper";
|
||||
import { createVSCodeCommandManager } from "../../../../src/common/vscode/commands";
|
||||
import { AllCommands } from "../../../../src/common/commands";
|
||||
|
||||
jest.setTimeout(30_000);
|
||||
|
||||
@@ -30,7 +31,7 @@ async function showQlDocument(name: string): Promise<TextDocument> {
|
||||
}
|
||||
|
||||
describe("Variant Analysis Submission Integration", () => {
|
||||
const commandManager = createVSCodeCommandManager();
|
||||
const commandManager = createVSCodeCommandManager<AllCommands>();
|
||||
let quickPickSpy: jest.SpiedFunction<typeof window.showQuickPick>;
|
||||
let executeCommandSpy: jest.SpiedFunction<typeof commands.executeCommand>;
|
||||
let showErrorMessageSpy: jest.SpiedFunction<typeof window.showErrorMessage>;
|
||||
|
||||
Reference in New Issue
Block a user