File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
test/vscode-tests/no-workspace Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -295,10 +295,20 @@ export async function prepareCodeTour(): Promise<void> {
295295 existsSync ( toursFolderPath ) &&
296296 ! isCodespacesTemplate ( )
297297 ) {
298+ const answer = await showBinaryChoiceDialog (
299+ "We've detected you're in the CodeQL Tour repo. We will need to open the workspace file to continue. Reload?" ,
300+ ) ;
301+
302+ if ( ! answer ) {
303+ return ;
304+ }
305+
298306 const tutorialWorkspaceUri = Uri . parse ( tutorialWorkspacePath ) ;
307+
299308 void extLogger . log (
300309 `In prepareCodeTour() method, going to open the tutorial workspace file: ${ tutorialWorkspacePath } ` ,
301310 ) ;
311+
302312 await commands . executeCommand ( "vscode.openFolder" , tutorialWorkspaceUri ) ;
303313 }
304314 }
Original file line number Diff line number Diff line change @@ -572,6 +572,9 @@ describe("isFolderAlreadyInWorkspace", () => {
572572
573573describe ( "prepareCodeTour" , ( ) => {
574574 let dir : tmp . DirResult ;
575+ let showInformationMessageSpy : jest . SpiedFunction <
576+ typeof window . showInformationMessage
577+ > ;
575578
576579 beforeEach ( ( ) => {
577580 dir = tmp . dirSync ( ) ;
@@ -587,6 +590,10 @@ describe("prepareCodeTour", () => {
587590 jest
588591 . spyOn ( workspace , "workspaceFolders" , "get" )
589592 . mockReturnValue ( mockWorkspaceFolders ) ;
593+
594+ showInformationMessageSpy = jest
595+ . spyOn ( window , "showInformationMessage" )
596+ . mockResolvedValue ( { title : "Yes" } ) ;
590597 } ) ;
591598
592599 afterEach ( ( ) => {
@@ -610,6 +617,7 @@ describe("prepareCodeTour", () => {
610617
611618 await prepareCodeTour ( ) ;
612619
620+ expect ( showInformationMessageSpy ) . toHaveBeenCalled ( ) ;
613621 expect ( commandSpy ) . toHaveBeenCalledWith (
614622 "vscode.openFolder" ,
615623 Uri . parse ( tutorialWorkspacePath ) ,
You can’t perform that action at this time.
0 commit comments