* 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[])
| 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. |
no test coverage detected