(options: AssertOptions)
| 346 | } |
| 347 | |
| 348 | async assertRaw(options: AssertOptions): Promise<void> { |
| 349 | if (!options.rawSnapshot) { |
| 350 | throw new Error('Raw snapshot is required') |
| 351 | } |
| 352 | |
| 353 | const { filepath, rawSnapshot } = options |
| 354 | |
| 355 | if (rawSnapshot.content == null) { |
| 356 | if (!filepath) { |
| 357 | throw new Error('Snapshot cannot be used outside of test') |
| 358 | } |
| 359 | |
| 360 | const snapshotState = this.getSnapshotState(filepath) |
| 361 | |
| 362 | // save the filepath, so it don't lose even if the await make it out-of-context |
| 363 | options.filepath ||= filepath |
| 364 | // resolve and read the raw snapshot file |
| 365 | rawSnapshot.file = await snapshotState.environment.resolveRawPath( |
| 366 | filepath, |
| 367 | rawSnapshot.file, |
| 368 | ) |
| 369 | rawSnapshot.content |
| 370 | = (await snapshotState.environment.readSnapshotFile(rawSnapshot.file)) |
| 371 | ?? undefined |
| 372 | } |
| 373 | |
| 374 | return this.assert(options) |
| 375 | } |
| 376 | |
| 377 | clear(): void { |
| 378 | this.snapshotStateMap.clear() |
nothing calls this directly
no test coverage detected