@@ -728,12 +728,18 @@ describe("CDP/Selectivity", () => {
728728 } ;
729729
730730 beforeEach ( ( ) => {
731+ delete process . env . TESTPLANE_SELECTIVITY_CLEAR_UNUSED_DUMPS ;
732+
731733 configMock = {
732734 getBrowserIds : sandbox . stub ( ) ,
733735 forBrowser : sandbox . stub ( ) ,
734736 } ;
735737 } ) ;
736738
739+ afterEach ( ( ) => {
740+ delete process . env . TESTPLANE_SELECTIVITY_CLEAR_UNUSED_DUMPS ;
741+ } ) ;
742+
737743 it ( "should skip browsers with selectivity disabled" , async ( ) => {
738744 configMock . getBrowserIds . returns ( [ "chrome" , "firefox" ] ) ;
739745 configMock . forBrowser
@@ -1200,5 +1206,27 @@ describe("CDP/Selectivity", () => {
12001206 assert . notCalled ( getSelectivityTestsPathStub ) ;
12011207 assert . notCalled ( fsStub . access ) ;
12021208 } ) ;
1209+
1210+ it ( "should skip cleanup when TESTPLANE_SELECTIVITY_CLEAR_UNUSED_DUMPS env var is 'false'" , async ( ) => {
1211+ process . env . TESTPLANE_SELECTIVITY_CLEAR_UNUSED_DUMPS = "false" ;
1212+
1213+ configMock . getBrowserIds . returns ( [ "chrome" ] ) ;
1214+ configMock . forBrowser . withArgs ( "chrome" ) . returns ( {
1215+ lastFailed : { only : false } ,
1216+ selectivity : {
1217+ enabled : SelectivityMode . Enabled ,
1218+ saveIncompleteDumpOnFail : false ,
1219+ testDependenciesPath : "/test/deps" ,
1220+ } ,
1221+ } ) ;
1222+
1223+ await clearUnusedSelectivityDumps ( configMock as any , false ) ;
1224+
1225+ assert . notCalled ( configMock . getBrowserIds ) ;
1226+ assert . notCalled ( usedDumpsTrackerMock . usedDumpsFor ) ;
1227+ assert . notCalled ( getSelectivityTestsPathStub ) ;
1228+ assert . notCalled ( fsStub . readdir ) ;
1229+ assert . notCalled ( fsStub . unlink ) ;
1230+ } ) ;
12031231 } ) ;
12041232} ) ;
0 commit comments