MCPcopy
hub / github.com/vitest-dev/vitest / collectFiles

Method collectFiles

packages/vitest/src/node/state.ts:145–163  ·  view source on GitHub ↗
(project: TestProject, files: File[] = [])

Source from the content-addressed store, hash-verified

143 }
144
145 collectFiles(project: TestProject, files: File[] = []): void {
146 files.forEach((file) => {
147 const existing = this.filesMap.get(file.filepath) || []
148 const otherFiles = existing.filter(
149 i => i.projectName !== file.projectName || i.meta.typecheck !== file.meta.typecheck,
150 )
151 const currentFile = existing.find(
152 i => i.projectName === file.projectName,
153 )
154 // keep logs for the previous file because it should always be initiated before the collections phase
155 // which means that all logs are collected during the collection and not inside tests
156 if (currentFile) {
157 file.logs = currentFile.logs
158 }
159 otherFiles.push(file)
160 this.filesMap.set(file.filepath, otherFiles)
161 this.updateId(file, project)
162 })
163 }
164
165 clearFiles(
166 project: TestProject,

Callers 8

cancelFilesMethod · 0.95
enqueuedMethod · 0.45
collectedMethod · 0.45
onQueuedFunction · 0.45
onCollectedFunction · 0.45
collectTestsFunction · 0.45

Calls 4

updateIdMethod · 0.95
filterMethod · 0.65
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected