(spec: TextSnapshotSpec)
| 28 | } |
| 29 | |
| 30 | export function expectTextSnapshot(spec: TextSnapshotSpec): void { |
| 31 | const snapshotPath = fileURLToPath(spec.snapshotFileUrl) |
| 32 | const actual = formatTextSnapshot(spec) |
| 33 | if (process.env.UPDATE_TEXT_SNAPSHOTS === '1') { |
| 34 | writeFileSync(snapshotPath, actual, 'utf8') |
| 35 | } |
| 36 | const expected = normalizeSnapshotText(readFileSync(snapshotPath, 'utf8')) |
| 37 | expect(actual).toBe(expected) |
| 38 | } |