File tree 2 files changed +14
-4
lines changed
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
248
248
}
249
249
}
250
250
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
+ }
253
258
}
254
259
255
260
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
239
239
}
240
240
}
241
241
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
+ }
244
249
}
245
250
246
251
private async getUntestedFiles ( testedFiles : string [ ] ) : Promise < RawCoverage > {
You can’t perform that action at this time.
0 commit comments