Skip to content

Commit 4d5597d

Browse files
authored
fix(vitest): print only running files, not every file (#6052)
1 parent f94ede0 commit 4d5597d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

packages/runner/src/types/tasks.ts

+4
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ export interface File extends Suite {
6868
projectName: string | undefined
6969
collectDuration?: number
7070
setupDuration?: number
71+
/**
72+
* Whether the file is initiated without running any tests.
73+
*/
74+
local?: boolean
7175
}
7276

7377
export interface Test<ExtraContext = {}> extends TaskPopulated {

packages/vitest/src/node/state.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,17 @@ export class StateManager {
6969
return Array.from(this.pathsSet)
7070
}
7171

72+
/**
73+
* Return files that were running or collected.
74+
*/
7275
getFiles(keys?: string[]): File[] {
7376
if (keys) {
7477
return keys
7578
.map(key => this.filesMap.get(key)!)
76-
.filter(Boolean)
7779
.flat()
80+
.filter(file => file && !file.local)
7881
}
79-
return Array.from(this.filesMap.values()).flat()
82+
return Array.from(this.filesMap.values()).flat().filter(file => !file.local)
8083
}
8184

8285
getFilepaths(): string[] {
@@ -128,6 +131,7 @@ export class StateManager {
128131
project.config.root,
129132
project.config.name,
130133
)
134+
fileTask.local = true
131135
this.idMap.set(fileTask.id, fileTask)
132136
if (!files) {
133137
this.filesMap.set(path, [fileTask])

0 commit comments

Comments
 (0)