Returns true if lcov reporter is already present or was successfully added.
( options: CoverageOptions, tree?: PluginSetupTree, )
| 156 | |
| 157 | /** Returns true if lcov reporter is already present or was successfully added. */ |
| 158 | async function configureLcovReporter( |
| 159 | options: CoverageOptions, |
| 160 | tree?: PluginSetupTree, |
| 161 | ): Promise<boolean> { |
| 162 | const { framework, configFile } = options; |
| 163 | if (framework === 'other' || !configFile || !tree) { |
| 164 | return false; |
| 165 | } |
| 166 | const content = await tree.read(configFile); |
| 167 | if (content == null) { |
| 168 | return false; |
| 169 | } |
| 170 | if (hasLcovReporter(content, framework)) { |
| 171 | return true; |
| 172 | } |
| 173 | const modified = addLcovReporter(content, framework); |
| 174 | if (modified === content) { |
| 175 | return false; |
| 176 | } |
| 177 | await tree.write(configFile, modified); |
| 178 | return true; |
| 179 | } |
| 180 | |
| 181 | function formatPluginInit( |
| 182 | options: CoverageOptions, |
no test coverage detected