(outputPath: string, overwrite: boolean)
| 153 | } |
| 154 | |
| 155 | async function assertWritableOutput(outputPath: string, overwrite: boolean): Promise<void> { |
| 156 | try { |
| 157 | const outputStats = await lstat(outputPath); |
| 158 | if (outputStats.isSymbolicLink()) throw new Error(`Refusing to overwrite a symbolic link: ${outputPath}`); |
| 159 | if (!outputStats.isFile()) throw new Error(`Output path is not a regular file: ${outputPath}`); |
| 160 | if (!overwrite) throw new Error(`Output path already exists; enable overwrite explicitly: ${outputPath}`); |
| 161 | } catch (error: unknown) { |
| 162 | if (!isMissingPathError(error)) throw error; |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | export async function migrateTestFiles(options: MigrateFilesOptions): Promise<readonly MigratedFile[]> { |
| 167 | if (options.write && !options.outputRoot) { |
no test coverage detected