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

Method updateSnapshot

packages/vitest/src/node/core.ts:1299–1314  ·  view source on GitHub ↗

* Update snapshots in specified files. If no files are provided, it will update files with failed tests and obsolete snapshots. * @param files The list of files on the file system

(files?: string[])

Source from the content-addressed store, hash-verified

1297 * @param files The list of files on the file system
1298 */
1299 async updateSnapshot(files?: string[]): Promise<TestRunResult> {
1300 // default to failed files
1301 files = files || [
1302 ...this.state.getFailedFilepaths(),
1303 ...this.snapshot.summary.uncheckedKeysByFile.map(s => s.filePath),
1304 ]
1305
1306 this.enableSnapshotUpdate()
1307
1308 try {
1309 return await this.rerunFiles(files, 'update snapshot', false)
1310 }
1311 finally {
1312 this.resetSnapshotUpdate()
1313 }
1314 }
1315
1316 /**
1317 * Enable the mode that allows updating snapshots when running tests.

Callers 8

updateSnapshotFunction · 0.80
_keypressHandlerFunction · 0.80
summary.test.tsFile · 0.80
cFunction · 0.80
tFunction · 0.80
cFunction · 0.80
tFunction · 0.80

Calls 4

enableSnapshotUpdateMethod · 0.95
rerunFilesMethod · 0.95
resetSnapshotUpdateMethod · 0.95
getFailedFilepathsMethod · 0.45

Tested by

no test coverage detected