@@ -16,8 +16,6 @@ namespace Harness.Parallel.Host {
16
16
const { fork } = require ( "child_process" ) as typeof import ( "child_process" ) ;
17
17
const { statSync, readFileSync } = require ( "fs" ) as typeof import ( "fs" ) ;
18
18
19
- const editSkipRate = 0.05
20
-
21
19
// NOTE: paths for module and types for FailedTestReporter _do not_ line up due to our use of --outFile for run.js
22
20
// tslint:disable-next-line:variable-name
23
21
const FailedTestReporter = require ( path . resolve ( __dirname , "../../scripts/failed-tests" ) ) as typeof import ( "../../../scripts/failed-tests" ) ;
@@ -194,7 +192,7 @@ namespace Harness.Parallel.Host {
194
192
return `tsrunner-${ runner } ://${ test } ` ;
195
193
}
196
194
197
- function skipCostlyTests ( tasks : Task [ ] , editSkipRate : number ) {
195
+ function skipCostlyTests ( tasks : Task [ ] ) {
198
196
if ( statSync ( '.test-cost.json' ) ) {
199
197
const costs = JSON . parse ( readFileSync ( '.test-cost.json' , 'utf8' ) ) as {
200
198
totalTime : number ,
@@ -205,12 +203,12 @@ namespace Harness.Parallel.Host {
205
203
let skippedTests = new Set < string > ( ) ;
206
204
let skippedTime = 0 ;
207
205
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 ++ ) {
209
207
skippedEdits += costs . data [ i ] . edits ;
210
208
skippedTime += costs . data [ i ] . time ;
211
209
skippedTests . add ( costs . data [ i ] . name ) ;
212
210
}
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.` )
214
212
return tasks . filter ( t => ! skippedTests . has ( t . file ) ) ;
215
213
}
216
214
else {
@@ -219,7 +217,7 @@ namespace Harness.Parallel.Host {
219
217
}
220
218
}
221
219
222
- function startDelayed ( perfData : { [ testHash : string ] : number } | undefined , totalCost : number , editSkipRate : number ) {
220
+ function startDelayed ( perfData : { [ testHash : string ] : number } | undefined , totalCost : number ) {
223
221
console . log ( `Discovered ${ tasks . length } unittest suites` + ( newTasks . length ? ` and ${ newTasks . length } new suites.` : "." ) ) ;
224
222
console . log ( "Discovering runner-based tests..." ) ;
225
223
const discoverStart = + ( new Date ( ) ) ;
@@ -258,7 +256,7 @@ namespace Harness.Parallel.Host {
258
256
}
259
257
tasks . sort ( ( a , b ) => a . size - b . size ) ;
260
258
tasks = tasks . concat ( newTasks ) ;
261
- tasks = skipCostlyTests ( tasks , editSkipRate ) ;
259
+ tasks = skipCostlyTests ( tasks ) ;
262
260
const batchCount = workerCount ;
263
261
const packfraction = 0.9 ;
264
262
const chunkSize = 1000 ; // ~1KB or 1s for sending batches near the end of a test
@@ -653,6 +651,6 @@ namespace Harness.Parallel.Host {
653
651
}
654
652
655
653
// 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
657
655
}
658
656
}
0 commit comments