Don't create QL pack if user escapes out of prompt (#3062)
This commit is contained in:
@@ -43,7 +43,9 @@ export function getFirstWorkspaceFolder() {
|
||||
const workspaceFolders = getOnDiskWorkspaceFolders();
|
||||
|
||||
if (!workspaceFolders || workspaceFolders.length === 0) {
|
||||
throw new Error("No workspace folders found");
|
||||
throw new Error(
|
||||
"No workspace folders found. Please open a folder or workspace in VS Code.",
|
||||
);
|
||||
}
|
||||
|
||||
const firstFolderFsPath = workspaceFolders[0];
|
||||
|
||||
@@ -265,7 +265,7 @@ export class DatabaseManager extends DisposableObject {
|
||||
`We've noticed you don't have a CodeQL pack available to analyze this database. Can we set up a query pack for you?`,
|
||||
);
|
||||
|
||||
if (answer === "No") {
|
||||
if (answer === "No" || answer === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -622,6 +622,16 @@ describe("local databases", () => {
|
||||
expect(generateSpy).not.toBeCalled();
|
||||
});
|
||||
|
||||
it("should return early if the user escapes out of the dialog", async () => {
|
||||
showNeverAskAgainDialogSpy = jest
|
||||
.spyOn(dialog, "showNeverAskAgainDialog")
|
||||
.mockResolvedValue(undefined);
|
||||
|
||||
await (databaseManager as any).createSkeletonPacks(mockDbItem);
|
||||
|
||||
expect(generateSpy).not.toBeCalled();
|
||||
});
|
||||
|
||||
it("should return early and write choice to settings if user wants to never be asked again", async () => {
|
||||
showNeverAskAgainDialogSpy = jest
|
||||
.spyOn(dialog, "showNeverAskAgainDialog")
|
||||
|
||||
Reference in New Issue
Block a user