@@ -12,9 +12,12 @@ import {
1212import { mockedQuickPickItem } from "../../utils/mocking.helpers" ;
1313import { getActivatedExtension } from "../../global.helper" ;
1414import {
15- showAndLogInformationMessage ,
1615 showAndLogExceptionWithTelemetry ,
16+ showAndLogInformationMessage ,
1717} from "../../../../src/common/logging" ;
18+ import * as workspaceFolders from "../../../../src/common/vscode/workspace-folders" ;
19+ import { getOnDiskWorkspaceFolders } from "../../../../src/common/vscode/workspace-folders" ;
20+ import { pathsEqual } from "../../../../src/common/files" ;
1821
1922describe ( "Packaging commands" , ( ) => {
2023 let cli : CodeQLCliServer ;
@@ -87,6 +90,48 @@ describe("Packaging commands", () => {
8790 ) . toEqual ( "Unable to download all packs. See log for more details." ) ;
8891 } ) ;
8992
93+ it ( "should only show workspace packs" , async ( ) => {
94+ const originalWorkspaceFolders = getOnDiskWorkspaceFolders ( ) ;
95+
96+ // Remove the CodeQL workspace folder from the list of workspace folders
97+ // since that includes all the packs that are already in the package cache,
98+ // so the test would be useless if we included it since nothing would be
99+ // filtered out (except for maybe the distribution legacy-upgrades).
100+ jest
101+ . spyOn ( workspaceFolders , "getOnDiskWorkspaceFolders" )
102+ . mockReturnValue (
103+ originalWorkspaceFolders . filter (
104+ ( folder ) => ! pathsEqual ( folder , process . env . TEST_CODEQL_PATH ?? "" ) ,
105+ ) ,
106+ ) ;
107+
108+ const rootDir = join ( __dirname , "../data" ) ;
109+ quickPickSpy . mockResolvedValue (
110+ mockedQuickPickItem ( [
111+ {
112+ label : "integration-test-queries-javascript" ,
113+ packRootDir : [ rootDir ] ,
114+ } ,
115+ ] ) ,
116+ ) ;
117+
118+ await handleInstallPackDependencies ( cli , progress ) ;
119+ expect ( quickPickSpy ) . toHaveBeenCalledWith (
120+ [
121+ expect . objectContaining ( {
122+ label : "integration-test-debugger-javascript" ,
123+ } ) ,
124+ expect . objectContaining ( {
125+ label : "semmle/has-extension" ,
126+ } ) ,
127+ expect . objectContaining ( {
128+ label : "semmle/targets-extension" ,
129+ } ) ,
130+ ] ,
131+ expect . anything ( ) ,
132+ ) ;
133+ } ) ;
134+
90135 it ( "should install valid workspace pack" , async ( ) => {
91136 const rootDir = join ( __dirname , "../data" ) ;
92137 quickPickSpy . mockResolvedValue (
0 commit comments