Skip to content

Commit

Permalink
fix(vitest): print only running files, not every file (#6052)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va authored Jul 8, 2024
1 parent f94ede0 commit 4d5597d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/runner/src/types/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ export interface File extends Suite {
projectName: string | undefined
collectDuration?: number
setupDuration?: number
/**
* Whether the file is initiated without running any tests.
*/
local?: boolean
}

export interface Test<ExtraContext = {}> extends TaskPopulated {
Expand Down
8 changes: 6 additions & 2 deletions packages/vitest/src/node/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,17 @@ export class StateManager {
return Array.from(this.pathsSet)
}

/**
* Return files that were running or collected.
*/
getFiles(keys?: string[]): File[] {
if (keys) {
return keys
.map(key => this.filesMap.get(key)!)
.filter(Boolean)
.flat()
.filter(file => file && !file.local)
}
return Array.from(this.filesMap.values()).flat()
return Array.from(this.filesMap.values()).flat().filter(file => !file.local)
}

getFilepaths(): string[] {
Expand Down Expand Up @@ -128,6 +131,7 @@ export class StateManager {
project.config.root,
project.config.name,
)
fileTask.local = true
this.idMap.set(fileTask.id, fileTask)
if (!files) {
this.filesMap.set(path, [fileTask])
Expand Down

0 comments on commit 4d5597d

Please sign in to comment.