@@ -9,11 +9,12 @@ import type { Test, TestDepsContext, TestDepsData } from "../../../types";
99import { MasterEvents } from "../../../events" ;
1010import { getHashWriter } from "./hash-writer" ;
1111import { getTestDependenciesReader } from "./test-dependencies-reader" ;
12+ import { selectivityShouldRead } from "./modes" ;
1213
1314/** Called at the start of testplane run per each browser */
1415const shouldDisableBrowserSelectivity = _ . memoize (
1516 async ( config : BrowserConfig , browserId : string ) : Promise < boolean > => {
16- if ( ! config . selectivity . enabled ) {
17+ if ( ! selectivityShouldRead ( config . selectivity . enabled ) ) {
1718 return true ;
1819 }
1920
@@ -60,8 +61,9 @@ const shouldDisableBrowserSelectivity = _.memoize(
6061 } ,
6162 config => {
6263 const { enabled, testDependenciesPath, compression, disableSelectivityPatterns } = config . selectivity ;
63- return enabled
64- ? enabled + "#" + testDependenciesPath + "#" + compression + "#" + disableSelectivityPatterns . join ( "#" )
64+
65+ return selectivityShouldRead ( enabled )
66+ ? testDependenciesPath + "#" + compression + "#" + disableSelectivityPatterns . join ( "#" )
6567 : "" ;
6668 } ,
6769) ;
@@ -70,7 +72,7 @@ const shouldDisableTestBySelectivity = _.memoize(
7072 async ( config : BrowserConfig , test : Test ) : Promise < boolean > => {
7173 const { enabled, testDependenciesPath, compression } = config . selectivity ;
7274
73- if ( ! enabled ) {
75+ if ( ! selectivityShouldRead ( enabled ) ) {
7476 return false ;
7577 }
7678
@@ -99,7 +101,7 @@ const shouldDisableTestBySelectivity = _.memoize(
99101 ( config , test ) => {
100102 const { enabled, testDependenciesPath, compression } = config . selectivity ;
101103
102- return enabled ? enabled + "#" + testDependenciesPath + "#" + compression + "#" + test . id : "" ;
104+ return selectivityShouldRead ( enabled ) ? testDependenciesPath + "#" + compression + "#" + test . id : "" ;
103105 } ,
104106) ;
105107
@@ -157,11 +159,11 @@ export class SelectivityRunner {
157159
158160 startTestCheckToRun ( test : Test , browserId : string ) : void {
159161 const browserConfig = this . _config . forBrowser ( browserId ) ;
160- const isSelectivityEnabledForBrowser = browserConfig . selectivity . enabled ;
162+ const shouldSelectivelySkipTests = selectivityShouldRead ( browserConfig . selectivity . enabled ) ;
161163
162164 // If selectivity is disabled for browser
163165 // If test is disabled on its own (e.g plugin testplane/chunks) we dont waste our time calculating the deps.
164- if ( ! isSelectivityEnabledForBrowser || this . _opts ?. shouldDisableSelectivity || test . disabled ) {
166+ if ( ! shouldSelectivelySkipTests || this . _opts ?. shouldDisableSelectivity || test . disabled ) {
165167 this . _testsToRun . push ( [ test , browserId ] ) ;
166168 return ;
167169 }
@@ -197,6 +199,10 @@ export class SelectivityRunner {
197199
198200 shouldDisableBrowserSelectivity . cache . clear ?.( ) ;
199201 shouldDisableTestBySelectivity . cache . clear ?.( ) ;
200- getHashReader ( this . _config . selectivity . testDependenciesPath , this . _config . selectivity . compression ) . clearCache ( ) ;
202+ this . _config . getBrowserIds ( ) . forEach ( browserId => {
203+ const { selectivity } = this . _config . forBrowser ( browserId ) ;
204+
205+ getHashReader ( selectivity . testDependenciesPath , selectivity . compression ) . clearCache ( ) ;
206+ } ) ;
201207 }
202208}
0 commit comments