(filePath: string)
| 78 | } |
| 79 | |
| 80 | function mapDistFileToSource(filePath: string): string { |
| 81 | const normalized = path.normalize(filePath); |
| 82 | const marker = `${path.sep}dist${path.sep}`; |
| 83 | const markerIndex = normalized.lastIndexOf(marker); |
| 84 | if (markerIndex < 0) return normalized; |
| 85 | |
| 86 | const before = normalized.slice(0, markerIndex); |
| 87 | const after = normalized.slice(markerIndex + marker.length); |
| 88 | const sourceLike = `${before}${path.sep}src${path.sep}${after}`; |
| 89 | const sourceTs = sourceLike.replace(/\.(?:c|m)?js$/u, ".ts"); |
| 90 | if (existsSync(sourceTs)) return sourceTs; |
| 91 | if (existsSync(sourceLike)) return sourceLike; |
| 92 | return normalized; |
| 93 | } |
| 94 | |
| 95 | function resolveSnapshotFile(name: string, opts: SnapshotMatchOptions | undefined): string { |
| 96 | const cwd = opts?.cwd ?? process.cwd(); |
no test coverage detected