@@ -16,8 +16,6 @@ namespace Harness.Parallel.Host {
1616 const { fork } = require ( "child_process" ) as typeof import ( "child_process" ) ;
1717 const { statSync, readFileSync } = require ( "fs" ) as typeof import ( "fs" ) ;
1818
19- const editSkipRate = 0.05
20-
2119 // NOTE: paths for module and types for FailedTestReporter _do not_ line up due to our use of --outFile for run.js
2220 // tslint:disable-next-line:variable-name
2321 const FailedTestReporter = require ( path . resolve ( __dirname , "../../scripts/failed-tests" ) ) as typeof import ( "../../../scripts/failed-tests" ) ;
@@ -194,7 +192,7 @@ namespace Harness.Parallel.Host {
194192 return `tsrunner-${ runner } ://${ test } ` ;
195193 }
196194
197- function skipCostlyTests ( tasks : Task [ ] , editSkipRate : number ) {
195+ function skipCostlyTests ( tasks : Task [ ] ) {
198196 if ( statSync ( '.test-cost.json' ) ) {
199197 const costs = JSON . parse ( readFileSync ( '.test-cost.json' , 'utf8' ) ) as {
200198 totalTime : number ,
@@ -205,12 +203,12 @@ namespace Harness.Parallel.Host {
205203 let skippedTests = new Set < string > ( ) ;
206204 let skippedTime = 0 ;
207205 let i = 0 ;
208- for ( ; i < costs . data . length && ( skippedEdits / costs . totalEdits ) < editSkipRate ; i ++ ) {
206+ for ( ; i < costs . data . length && ( skippedEdits / costs . totalEdits ) < ( skipPercent / 100 ) ; i ++ ) {
209207 skippedEdits += costs . data [ i ] . edits ;
210208 skippedTime += costs . data [ i ] . time ;
211209 skippedTests . add ( costs . data [ i ] . name ) ;
212210 }
213- console . log ( `Skipped ${ i } expensive tests; estimated time savings of ${ ( skippedTime / costs . totalTime * 100 ) . toFixed ( 2 ) } % with ${ ( editSkipRate * 100 ) . toFixed ( 2 ) } % chance of missing a test.` )
211+ console . log ( `Skipped ${ i } expensive tests; estimated time savings of ${ ( skippedTime / costs . totalTime * 100 ) . toFixed ( 2 ) } % with ${ skipPercent . toFixed ( 2 ) } % chance of missing a test.` )
214212 return tasks . filter ( t => ! skippedTests . has ( t . file ) ) ;
215213 }
216214 else {
@@ -219,7 +217,7 @@ namespace Harness.Parallel.Host {
219217 }
220218 }
221219
222- function startDelayed ( perfData : { [ testHash : string ] : number } | undefined , totalCost : number , editSkipRate : number ) {
220+ function startDelayed ( perfData : { [ testHash : string ] : number } | undefined , totalCost : number ) {
223221 console . log ( `Discovered ${ tasks . length } unittest suites` + ( newTasks . length ? ` and ${ newTasks . length } new suites.` : "." ) ) ;
224222 console . log ( "Discovering runner-based tests..." ) ;
225223 const discoverStart = + ( new Date ( ) ) ;
@@ -258,7 +256,7 @@ namespace Harness.Parallel.Host {
258256 }
259257 tasks . sort ( ( a , b ) => a . size - b . size ) ;
260258 tasks = tasks . concat ( newTasks ) ;
261- tasks = skipCostlyTests ( tasks , editSkipRate ) ;
259+ tasks = skipCostlyTests ( tasks ) ;
262260 const batchCount = workerCount ;
263261 const packfraction = 0.9 ;
264262 const chunkSize = 1000 ; // ~1KB or 1s for sending batches near the end of a test
@@ -653,6 +651,6 @@ namespace Harness.Parallel.Host {
653651 }
654652
655653 // tslint:disable-next-line:ban
656- setTimeout ( ( ) => startDelayed ( perfData , totalCost , editSkipRate ) , 0 ) ; // Do real startup on next tick, so all unit tests have been collected
654+ setTimeout ( ( ) => startDelayed ( perfData , totalCost ) , 0 ) ; // Do real startup on next tick, so all unit tests have been collected
657655 }
658656}
0 commit comments