@@ -315,31 +315,30 @@ export class Vitest {
315315
316316 const cwd = process . cwd ( )
317317
318- const projects : ( ( ) => Promise < WorkspaceProject > ) [ ] = [ ]
318+ const projects : WorkspaceProject [ ] = [ ]
319319
320320 try {
321321 // we have to resolve them one by one because CWD should depend on the project
322322 for ( const filepath of filteredWorkspaces ) {
323323 if ( this . server . config . configFile === filepath ) {
324324 const project = await this . createCoreProject ( )
325- projects . push ( ( ) => Promise . resolve ( project ) )
325+ projects . push ( project )
326326 continue
327327 }
328328 const dir = filepath . endsWith ( '/' ) ? filepath . slice ( 0 , - 1 ) : dirname ( filepath )
329329 if ( isMainThread )
330330 process . chdir ( dir )
331- // this just resolves the config, later we also wait when the server is resolved,
332- // but we can do that in parallel because it doesn't depend on process.cwd()
333- // this is strictly a performance optimization so we don't need to wait for server to start
334- projects . push ( await initializeProject ( filepath , this , { workspaceConfigPath, test : cliOverrides } ) )
331+ projects . push (
332+ await initializeProject ( filepath , this , { workspaceConfigPath, test : cliOverrides } ) ,
333+ )
335334 }
336335 }
337336 finally {
338337 if ( isMainThread )
339338 process . chdir ( cwd )
340339 }
341340
342- const projectPromises : Promise < ( ) => Promise < WorkspaceProject > > [ ] = [ ]
341+ const projectPromises : Promise < WorkspaceProject > [ ] = [ ]
343342
344343 projectsOptions . forEach ( ( options , index ) => {
345344 // we can resolve these in parallel because process.cwd() is not changed
@@ -349,14 +348,10 @@ export class Vitest {
349348 if ( ! projects . length && ! projectPromises . length )
350349 return [ await this . createCoreProject ( ) ]
351350
352- const resolvedProjectsReceivers = [
351+ const resolvedProjects = await Promise . all ( [
353352 ...projects ,
354353 ...await Promise . all ( projectPromises ) ,
355- ]
356- // we need to wait when the server is resolved, we can do that in parallel
357- const resolvedProjects = await Promise . all (
358- resolvedProjectsReceivers . map ( receiver => receiver ( ) ) ,
359- )
354+ ] )
360355 const names = new Set < string > ( )
361356
362357 for ( const project of resolvedProjects ) {
0 commit comments