( ts: TypeScript, cwd: string, tsconfig: string | undefined, diagnostics: ts.Diagnostic[] )
| 732 | } |
| 733 | |
| 734 | export const parseConfig = ( |
| 735 | ts: TypeScript, |
| 736 | cwd: string, |
| 737 | tsconfig: string | undefined, |
| 738 | diagnostics: ts.Diagnostic[] |
| 739 | ): ts.ParsedCommandLine => { |
| 740 | const configPath = |
| 741 | tsconfig ? |
| 742 | resolve(cwd, tsconfig) |
| 743 | : (ts.findConfigFile(cwd, ts.sys.fileExists) ?? |
| 744 | throwError(writeNoTsconfigMessage(cwd))) |
| 745 | const config = ts.getParsedCommandLineOfConfigFile(configPath, undefined, { |
| 746 | ...ts.sys, |
| 747 | onUnRecoverableConfigFileDiagnostic: d => diagnostics.push(d) |
| 748 | }) |
| 749 | if (!config) return throwError(formatDiagnostics(ts, diagnostics, cwd)) |
| 750 | diagnostics.push(...config.errors) |
| 751 | return config |
| 752 | } |
| 753 | |
| 754 | export const formatDiagnostics = ( |
| 755 | ts: TypeScript, |
no test coverage detected