File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -248,8 +248,13 @@ export class IstanbulCoverageProvider extends BaseCoverageProvider implements Co
248248 }
249249 }
250250
251- await fs . rm ( this . coverageFilesDirectory , { recursive : true } )
252- this . coverageFiles = new Map ( )
251+ // In watch mode we need to preserve the previous results if cleanOnRerun is disabled
252+ const keepResults = ! this . options . cleanOnRerun && this . ctx . config . watch
253+
254+ if ( ! keepResults ) {
255+ this . coverageFiles = new Map ( )
256+ await fs . rm ( this . coverageFilesDirectory , { recursive : true } )
257+ }
253258 }
254259
255260 async getCoverageMapForUncoveredFiles ( coveredFiles : string [ ] ) {
Original file line number Diff line number Diff line change @@ -239,8 +239,13 @@ export class V8CoverageProvider extends BaseCoverageProvider implements Coverage
239239 }
240240 }
241241
242- this . coverageFiles = new Map ( )
243- await fs . rm ( this . coverageFilesDirectory , { recursive : true } )
242+ // In watch mode we need to preserve the previous results if cleanOnRerun is disabled
243+ const keepResults = ! this . options . cleanOnRerun && this . ctx . config . watch
244+
245+ if ( ! keepResults ) {
246+ this . coverageFiles = new Map ( )
247+ await fs . rm ( this . coverageFilesDirectory , { recursive : true } )
248+ }
244249 }
245250
246251 private async getUntestedFiles ( testedFiles : string [ ] ) : Promise < RawCoverage > {
You can’t perform that action at this time.
0 commit comments