MCPcopy Create free account
hub / github.com/vitest-dev/vitest / assertBrowserFileAccess

Function assertBrowserFileAccess

packages/browser/src/node/utils.ts:100–110  ·  view source on GitHub ↗
(project: TestProject, path: string)

Source from the content-addressed store, hash-verified

98}
99
100export function assertBrowserFileAccess(project: TestProject, path: string): void {
101 const normalized = slash(path)
102 if (
103 !isFileLoadingAllowed(project.vite.config, normalized)
104 && !isFileLoadingAllowed(project.vitest.vite.config, normalized)
105 ) {
106 throw new Error(
107 `Access denied to "${path}". See Vite config documentation for "server.fs": https://vitejs.dev/config/server-options.html#server-fs-strict.`,
108 )
109 }
110}
111
112export function assertBrowserApiWrite(project: TestProject, path: string): void {
113 if (!project.config.browser.api.allowWrite || !project.vitest.config.api.allowWrite) {

Callers 12

readFileFunction · 0.90
writeFileFunction · 0.90
removeFileFunction · 0.90
_fileInfoFunction · 0.90
writeScreenshotFunction · 0.90
takeScreenshotFunction · 0.90
uploadFunction · 0.90
stopChunkTraceFunction · 0.90
deleteTracingFunction · 0.90
annotateTracesFunction · 0.90
takeScreenshotFunction · 0.90
uploadFunction · 0.90

Calls 1

slashFunction · 0.70

Tested by

no test coverage detected