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

Function formatTestPath

packages/vitest/src/node/reporters/renderers/utils.ts:69–79  ·  view source on GitHub ↗
(root: string, path: string)

Source from the content-addressed store, hash-verified

67}
68
69export function formatTestPath(root: string, path: string): string {
70 if (isAbsolute(path)) {
71 path = relative(root, path)
72 }
73
74 const dir = dirname(path)
75 const ext = path.match(/(\.(spec|test)\.[cm]?[tj]sx?)$/)?.[0] || ''
76 const base = basename(path, ext)
77
78 return slash(c.dim(`${dir}/`) + c.bold(base)) + c.dim(ext)
79}
80
81export function renderSnapshotSummary(
82 rootDir: string,

Callers 1

renderSnapshotSummaryFunction · 0.85

Calls 3

slashFunction · 0.90
relativeFunction · 0.50
matchMethod · 0.45

Tested by

no test coverage detected