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

Function createFile

test/test-utils/index.ts:363–371  ·  view source on GitHub ↗
(file: string, content: string)

Source from the content-addressed store, hash-verified

361const originalFiles = new Map<string, string>()
362
363export function createFile(file: string, content: string) {
364 fs.mkdirSync(dirname(file), { recursive: true })
365 fs.writeFileSync(file, content, 'utf-8')
366 onTestFinished(() => {
367 if (fs.existsSync(file)) {
368 fs.unlinkSync(file)
369 }
370 })
371}
372
373export function editFile(file: string, callback: (content: string) => string) {
374 const content = fs.readFileSync(file, 'utf-8')

Callers 6

vm-threads.test.tsFile · 0.90
useFSFunction · 0.85
caching.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected