@@ -63,12 +63,6 @@ describe('ActiveSolutionTracker', () => {
6363 } ,
6464 } ;
6565
66- ( vscode . workspace . findFiles as jest . Mock ) . mockResolvedValue ( [
67- SOLUTION_URI_FOO ,
68- SOLUTION_URI_BAR ,
69- SOLUTION_URI_DEFAULT ,
70- ] ) ;
71-
7266 changeSolutionsListener = jest . fn ( ) ;
7367 changeActiveListener = jest . fn ( ) ;
7468
@@ -78,6 +72,12 @@ describe('ActiveSolutionTracker', () => {
7872 configurationProvider = configurationProviderFactory ( ) ;
7973 workspaceFsProvider = workspaceFsProviderFactory ( ) ;
8074
75+ workspaceFoldersProvider . findFiles . mockResolvedValue ( [
76+ SOLUTION_URI_FOO ,
77+ SOLUTION_URI_BAR ,
78+ SOLUTION_URI_DEFAULT ,
79+ ] ) ;
80+
8181 activeSolutionTracker = new ActiveSolutionTrackerImpl (
8282 messageProviderFactory ( ) ,
8383 commandsProvider ,
@@ -101,13 +101,13 @@ describe('ActiveSolutionTracker', () => {
101101 it ( 'searches for solution files on activation' , async ( ) => {
102102 await activeSolutionTracker . activate ( context as unknown as vscode . ExtensionContext ) ;
103103 await waitForCondition (
104- async ( ) => ( vscode . workspace . findFiles as jest . Mock ) . mock . calls . length > 0 ,
104+ async ( ) => workspaceFoldersProvider . findFiles . mock . calls . length > 0 ,
105105 'solution file search to be triggered after activation' ,
106106 200 ,
107107 ) ;
108108
109- expect ( vscode . workspace . findFiles ) . toHaveBeenCalledTimes ( 1 ) ;
110- expect ( vscode . workspace . findFiles ) . toHaveBeenCalledWith ( ActiveSolutionTrackerImpl . GLOB_PATTERN , undefined ) ;
109+ expect ( workspaceFoldersProvider . findFiles ) . toHaveBeenCalledTimes ( 1 ) ;
110+ expect ( workspaceFoldersProvider . findFiles ) . toHaveBeenCalledWith ( ActiveSolutionTrackerImpl . GLOB_PATTERN , undefined ) ;
111111 } ) ;
112112
113113 it ( 'uses the configured glob pattern for searches' , async ( ) => {
@@ -116,24 +116,24 @@ describe('ActiveSolutionTracker', () => {
116116
117117 await activeSolutionTracker . activate ( context as unknown as vscode . ExtensionContext ) ;
118118 await waitForCondition (
119- async ( ) => ( vscode . workspace . findFiles as jest . Mock ) . mock . calls . length > 0 ,
119+ async ( ) => workspaceFoldersProvider . findFiles . mock . calls . length > 0 ,
120120 'solution file search to be triggered with configured exclude glob' ,
121121 200 ,
122122 ) ;
123123
124- expect ( vscode . workspace . findFiles ) . toHaveBeenCalledTimes ( 1 ) ;
125- expect ( vscode . workspace . findFiles ) . toHaveBeenCalledWith ( ActiveSolutionTrackerImpl . GLOB_PATTERN , testGlobPattern ) ;
124+ expect ( workspaceFoldersProvider . findFiles ) . toHaveBeenCalledTimes ( 1 ) ;
125+ expect ( workspaceFoldersProvider . findFiles ) . toHaveBeenCalledWith ( ActiveSolutionTrackerImpl . GLOB_PATTERN , testGlobPattern ) ;
126126 } ) ;
127127
128128 it ( 'updates when the configured glob pattern changes' , async ( ) => {
129129 await activeSolutionTracker . activate ( context as unknown as vscode . ExtensionContext ) ;
130130 await waitForCondition (
131- async ( ) => ( vscode . workspace . findFiles as jest . Mock ) . mock . calls . length > 0 ,
131+ async ( ) => workspaceFoldersProvider . findFiles . mock . calls . length > 0 ,
132132 'initial solution file search to complete' ,
133133 200 ,
134134 ) ;
135135
136- ( vscode . workspace . findFiles as jest . Mock ) . mockClear ( ) ;
136+ workspaceFoldersProvider . findFiles . mockClear ( ) ;
137137
138138 expect ( configurationProvider . onChangeConfiguration ) . toHaveBeenCalledTimes ( 1 ) ;
139139 expect ( configurationProvider . onChangeConfiguration ) . toHaveBeenCalledWith ( expect . any ( Function ) , manifest . CONFIG_EXCLUDE ) ;
@@ -142,22 +142,22 @@ describe('ActiveSolutionTracker', () => {
142142 configurationProvider . getConfigVariable . mockImplementation ( ( name : string ) => name === manifest . CONFIG_EXCLUDE ? testGlobPattern : undefined ) ;
143143 configurationProvider . onChangeConfiguration . mock . calls [ 0 ] [ 0 ] ( ) ;
144144 await waitForCondition (
145- async ( ) => ( vscode . workspace . findFiles as jest . Mock ) . mock . calls . length > 0 ,
145+ async ( ) => workspaceFoldersProvider . findFiles . mock . calls . length > 0 ,
146146 'solution file search to run after configuration change' ,
147147 200 ,
148148 ) ;
149149
150- expect ( vscode . workspace . findFiles ) . toHaveBeenCalledTimes ( 1 ) ;
151- expect ( vscode . workspace . findFiles ) . toHaveBeenCalledWith ( ActiveSolutionTrackerImpl . GLOB_PATTERN , testGlobPattern ) ;
150+ expect ( workspaceFoldersProvider . findFiles ) . toHaveBeenCalledTimes ( 1 ) ;
151+ expect ( workspaceFoldersProvider . findFiles ) . toHaveBeenCalledWith ( ActiveSolutionTrackerImpl . GLOB_PATTERN , testGlobPattern ) ;
152152 } ) ;
153153
154154 describe ( 'activated with no solutions in the workspace' , ( ) => {
155155 beforeEach ( async ( ) => {
156- ( vscode . workspace . findFiles as jest . Mock ) . mockResolvedValue ( [ ] ) ;
156+ workspaceFoldersProvider . findFiles . mockResolvedValue ( [ ] ) ;
157157
158158 await activeSolutionTracker . activate ( context as unknown as vscode . ExtensionContext ) ;
159159 await waitForCondition (
160- async ( ) => ( vscode . workspace . findFiles as jest . Mock ) . mock . calls . length > 0 ,
160+ async ( ) => workspaceFoldersProvider . findFiles . mock . calls . length > 0 ,
161161 'solution file search to complete in empty workspace' ,
162162 200 ,
163163 ) ;
@@ -240,7 +240,7 @@ describe('ActiveSolutionTracker', () => {
240240
241241 describe ( 'activated with solutions in workspace subfolders only' , ( ) => {
242242 beforeEach ( async ( ) => {
243- ( vscode . workspace . findFiles as jest . Mock ) . mockResolvedValue ( [
243+ workspaceFoldersProvider . findFiles . mockResolvedValue ( [
244244 SOLUTION_URI_FOO ,
245245 SOLUTION_URI_BAR ,
246246 ] ) ;
@@ -301,7 +301,7 @@ describe('ActiveSolutionTracker', () => {
301301 } ) ;
302302
303303 it ( 'updates the list of solutions when a new solution file is added' , async ( ) => {
304- ( vscode . workspace . findFiles as jest . Mock ) . mockResolvedValue ( [
304+ workspaceFoldersProvider . findFiles . mockResolvedValue ( [
305305 SOLUTION_URI_NEW ,
306306 SOLUTION_URI_FOO ,
307307 SOLUTION_URI_BAR
@@ -321,7 +321,7 @@ describe('ActiveSolutionTracker', () => {
321321 } ) ;
322322
323323 it ( 'updates the list of solutions when a solution file is deleted' , async ( ) => {
324- ( vscode . workspace . findFiles as jest . Mock ) . mockResolvedValue ( [
324+ workspaceFoldersProvider . findFiles . mockResolvedValue ( [
325325 SOLUTION_URI_FOO ,
326326 ] ) ;
327327
@@ -337,7 +337,7 @@ describe('ActiveSolutionTracker', () => {
337337 } ) ;
338338
339339 it ( 'updates the list of solutions when a folder containing a solution file is deleted' , async ( ) => {
340- ( vscode . workspace . findFiles as jest . Mock ) . mockResolvedValue ( [
340+ workspaceFoldersProvider . findFiles . mockResolvedValue ( [
341341 SOLUTION_URI_FOO ,
342342 ] ) ;
343343
@@ -353,7 +353,7 @@ describe('ActiveSolutionTracker', () => {
353353 } ) ;
354354
355355 it ( 'updates the list of solutions when a new workspace folder is added' , async ( ) => {
356- ( vscode . workspace . findFiles as jest . Mock ) . mockResolvedValue ( [
356+ workspaceFoldersProvider . findFiles . mockResolvedValue ( [
357357 SOLUTION_URI_NEW ,
358358 SOLUTION_URI_FOO ,
359359 SOLUTION_URI_BAR
@@ -490,14 +490,14 @@ describe('ActiveSolutionTracker solution file watching', () => {
490490 } ,
491491 } ;
492492
493- ( vscode . workspace . findFiles as jest . Mock ) . mockResolvedValue ( [ URI . file ( activeSolution ) ] ) ;
494-
495493 fileWatcherProvider = fileWatcherProviderFactory ( ) ;
496494 commandsProvider = commandsProviderFactory ( ) ;
497495 workspaceFoldersProvider = workspaceFoldersProviderFactory ( [ { uri : URI . file ( solutionRoot ) , name : 'workspace' , index : 0 } ] ) ;
498496 workspaceFsProvider = workspaceFsProviderFactory ( ) ;
499497 configurationProvider = configurationProviderFactory ( ) ;
500498
499+ workspaceFoldersProvider . findFiles . mockResolvedValue ( [ URI . file ( activeSolution ) ] ) ;
500+
501501 tracker = new ActiveSolutionTrackerImpl (
502502 messageProviderFactory ( ) ,
503503 commandsProvider ,
0 commit comments