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

Function resolveScreenshotPath

packages/browser/src/node/utils.ts:45–65  ·  view source on GitHub ↗
(
  testPath: string,
  name: string,
  config: ResolvedConfig,
  customPath: string | undefined,
)

Source from the content-addressed store, hash-verified

43}
44
45export function resolveScreenshotPath(
46 testPath: string,
47 name: string,
48 config: ResolvedConfig,
49 customPath: string | undefined,
50): string {
51 if (customPath) {
52 return resolve(dirname(testPath), customPath)
53 }
54 const dir = dirname(testPath)
55 const base = basename(testPath)
56 if (config.browser.screenshotDirectory) {
57 return resolve(
58 config.browser.screenshotDirectory,
59 relative(config.root, dir),
60 base,
61 name,
62 )
63 }
64 return resolve(dir, '__screenshots__', base, name)
65}
66
67export async function getBrowserProvider(
68 options: ResolvedBrowserOptions,

Callers 2

takeScreenshotFunction · 0.90
takeScreenshotFunction · 0.90

Calls 2

resolveFunction · 0.50
relativeFunction · 0.50

Tested by

no test coverage detected