(
tsm: typeof ts,
compilerOptions: ts.CompilerOptions,
rootFileNames: ReadonlyArray<string>,
defaultDir: string
)
| 113 | } |
| 114 | |
| 115 | function getConfig( |
| 116 | tsm: typeof ts, |
| 117 | compilerOptions: ts.CompilerOptions, |
| 118 | rootFileNames: ReadonlyArray<string>, |
| 119 | defaultDir: string |
| 120 | ) { |
| 121 | if (compilerOptions.configFilePath === undefined) { |
| 122 | const dir = rootFileNames.length > 0 ? dirname(rootFileNames[0]) : defaultDir; |
| 123 | const tsconfigPath = tsm.findConfigFile(dir, tsm.sys.fileExists); |
| 124 | if (tsconfigPath) { |
| 125 | const projectDir = dirname(tsconfigPath); |
| 126 | const config = readConfig(tsm, tsconfigPath, dirname(tsconfigPath)); |
| 127 | compilerOptions = { ...config.options, ...compilerOptions }; |
| 128 | return { |
| 129 | projectDir, |
| 130 | compilerOptions, |
| 131 | }; |
| 132 | } |
| 133 | } |
| 134 | return { |
| 135 | projectDir: dirname(compilerOptions.configFilePath as string), |
| 136 | compilerOptions, |
| 137 | }; |
| 138 | } |
| 139 | |
| 140 | function readConfig(tsm: typeof ts, configFileNamePath: string, projectDir: string) { |
| 141 | const result = tsm.readConfigFile(configFileNamePath, tsm.sys.readFile); |
no test coverage detected
searching dependent graphs…