(deps: ResolvedDoctorDeps, spec: CheckSpec)
| 191 | } |
| 192 | |
| 193 | async function checkTomlFile(deps: ResolvedDoctorDeps, spec: CheckSpec): Promise<CheckResult> { |
| 194 | if (!deps.fileExists(spec.path)) { |
| 195 | return { |
| 196 | label: spec.label, |
| 197 | path: spec.path, |
| 198 | status: spec.explicit ? 'ERROR' : 'SKIP', |
| 199 | message: spec.explicit |
| 200 | ? 'File does not exist.' |
| 201 | : 'File does not exist; built-in defaults will apply.', |
| 202 | }; |
| 203 | } |
| 204 | |
| 205 | try { |
| 206 | const text = await deps.readTextFile(spec.path); |
| 207 | await spec.parse(text, spec.path); |
| 208 | return { label: spec.label, path: spec.path, status: 'OK' }; |
| 209 | } catch (error) { |
| 210 | return { |
| 211 | label: spec.label, |
| 212 | path: spec.path, |
| 213 | status: 'ERROR', |
| 214 | message: formatErrorMessage(error, spec.path), |
| 215 | }; |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | async function resolveConfigTargetPath( |
| 220 | deps: ResolvedDoctorDeps, |
no test coverage detected