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

Function createFileTask

packages/runner/src/utils/collect.ts:196–220  ·  view source on GitHub ↗
(
  filepath: string,
  root: string,
  projectName: string | undefined,
  pool?: string,
  viteEnvironment?: string,
)

Source from the content-addressed store, hash-verified

194}
195
196export function createFileTask(
197 filepath: string,
198 root: string,
199 projectName: string | undefined,
200 pool?: string,
201 viteEnvironment?: string,
202): File {
203 const path = relative(root, filepath)
204 const file: File = {
205 id: generateFileHash(path, projectName),
206 name: path,
207 fullName: path,
208 type: 'suite',
209 mode: 'queued',
210 filepath,
211 tasks: [],
212 meta: Object.create(null),
213 projectName,
214 file: undefined!,
215 pool,
216 viteEnvironment,
217 }
218 file.file = file
219 return file
220}
221
222/**
223 * Generate a unique ID for a file based on its path and project name

Callers 9

collectTestsFunction · 0.90
clearFilesMethod · 0.90
index.tsFile · 0.90
clearFilesMethod · 0.90
cancelFilesMethod · 0.90
utils.tsFile · 0.90
junit.test.tsFile · 0.90
onMessageFunction · 0.90

Calls 3

generateFileHashFunction · 0.85
createMethod · 0.80
relativeFunction · 0.50

Tested by

no test coverage detected