@@ -87,7 +87,7 @@ import { StorageManager } from "@syntest/storage";
87
87
88
88
import { TestCommandOptions } from "./commands/test" ;
89
89
import { DeDuplicator } from "./workflows/DeDuplicator" ;
90
- import { addMetaComments } from "./workflows/MetaComment " ;
90
+ import { MetaCommenter } from "./workflows/MetaCommenter " ;
91
91
import { TestSplitting } from "./workflows/TestSplitter" ;
92
92
93
93
export type JavaScriptArguments = ArgumentsObject & TestCommandOptions ;
@@ -440,7 +440,6 @@ export class JavaScriptLauncher extends Launcher<JavaScriptArguments> {
440
440
this . userInterface . printHeader ( "Postprocessing started" ) ;
441
441
JavaScriptLauncher . LOGGER . info ( "Postprocessing started" ) ;
442
442
const start = Date . now ( ) ;
443
- const testSplitter = new TestSplitting ( this . runner ) ;
444
443
const objectives = new Map < Target , ObjectiveFunction < JavaScriptTestCase > [ ] > (
445
444
[ ...this . archives . entries ( ) ] . map ( ( [ target , archive ] ) => [
446
445
target ,
@@ -455,17 +454,21 @@ export class JavaScriptLauncher extends Launcher<JavaScriptArguments> {
455
454
) ;
456
455
457
456
if ( this . arguments_ . testSplitting ) {
457
+ const testSplitter = new TestSplitting ( this . userInterface , this . runner ) ;
458
+
458
459
const start = Date . now ( ) ;
459
- const before = [ ...finalEncodings . values ( ) ]
460
- . map ( ( x ) => x . length )
461
- . reduce ( ( p , c ) => p + c ) ;
460
+ const before = [ ...finalEncodings . values ( ) ] . reduce (
461
+ ( p , c ) => p + c . length ,
462
+ 0
463
+ ) ;
462
464
JavaScriptLauncher . LOGGER . info ( "Splitting started" ) ;
463
- finalEncodings = await testSplitter . testSplitting ( finalEncodings ) ;
465
+ finalEncodings = await testSplitter . execute ( finalEncodings ) ;
464
466
465
467
const timeInMs = ( Date . now ( ) - start ) / 1000 ;
466
- const after = [ ...finalEncodings . values ( ) ]
467
- . map ( ( x ) => x . length )
468
- . reduce ( ( p , c ) => p + c ) ;
468
+ const after = [ ...finalEncodings . values ( ) ] . reduce (
469
+ ( p , c ) => p + c . length ,
470
+ 0
471
+ ) ;
469
472
470
473
JavaScriptLauncher . LOGGER . info (
471
474
`Splitting done took: ${ timeInMs } , went from ${ before } to ${ after } test cases`
@@ -476,9 +479,11 @@ export class JavaScriptLauncher extends Launcher<JavaScriptArguments> {
476
479
477
480
// this.metricManager.recordProperty(PropertyName., `${timeInMs}`); // TODO new metric
478
481
}
482
+
479
483
if ( this . arguments_ . testMinimization ) {
480
484
const start = Date . now ( ) ;
481
485
JavaScriptLauncher . LOGGER . info ( "Minimization started" ) ;
486
+ // TODO
482
487
const timeInMs = ( Date . now ( ) - start ) / 1000 ;
483
488
JavaScriptLauncher . LOGGER . info ( `Minimization done, took: ${ timeInMs } ` ) ;
484
489
// this.metricManager.recordProperty(PropertyName., `${timeInMs}`); // TODO new metric
@@ -495,40 +500,50 @@ export class JavaScriptLauncher extends Launcher<JavaScriptArguments> {
495
500
}
496
501
) ;
497
502
498
- const startDeduplication = Date . now ( ) ;
499
- const before = [ ...finalEncodings . values ( ) ]
500
- . map ( ( x ) => x . length )
501
- . reduce ( ( p , c ) => p + c ) ;
502
- JavaScriptLauncher . LOGGER . info ( "De-Duplication started" ) ;
503
+ if ( this . arguments_ . testDeDuplication ) {
504
+ const deDuplicator = new DeDuplicator (
505
+ this . userInterface ,
506
+ secondaryObjectives ,
507
+ objectives
508
+ ) ;
503
509
504
- const deDuplicator = new DeDuplicator ( ) ;
505
- const newArchives = deDuplicator . deDuplicate (
506
- secondaryObjectives ,
507
- objectives ,
508
- finalEncodings
509
- ) ;
510
+ const start = Date . now ( ) ;
511
+ const before = [ ... finalEncodings . values ( ) ] . reduce (
512
+ ( p , c ) => p + c . length ,
513
+ 0
514
+ ) ;
515
+ JavaScriptLauncher . LOGGER . info ( "De-Duplication started" ) ;
510
516
511
- const timeInMsDeDuplication = ( Date . now ( ) - startDeduplication ) / 1000 ;
512
- const after = [ ...newArchives . values ( ) ]
513
- . map ( ( x ) => x . size )
514
- . reduce ( ( p , c ) => p + c ) ;
517
+ finalEncodings = await deDuplicator . execute ( finalEncodings ) ;
515
518
516
- JavaScriptLauncher . LOGGER . info (
517
- `De-Duplication done took: ${ timeInMsDeDuplication } , went from ${ before } to ${ after } test cases`
518
- ) ;
519
- this . userInterface . printSuccess (
520
- `De-Duplication done took: ${ timeInMsDeDuplication } , went from ${ before } to ${ after } test cases`
521
- ) ;
519
+ const timeInMs = ( Date . now ( ) - start ) / 1000 ;
520
+ const after = [ ...finalEncodings . values ( ) ] . reduce (
521
+ ( p , c ) => p + c . length ,
522
+ 0
523
+ ) ;
522
524
523
- if ( this . arguments_ . metaComments ) {
524
- addMetaComments ( newArchives ) ;
525
+ JavaScriptLauncher . LOGGER . info (
526
+ `De-Duplication done took: ${ timeInMs } , went from ${ before } to ${ after } test cases`
527
+ ) ;
528
+ this . userInterface . printSuccess (
529
+ `De-Duplication done took: ${ timeInMs } , went from ${ before } to ${ after } test cases`
530
+ ) ;
525
531
}
526
532
527
- finalEncodings = new Map < Target , JavaScriptTestCase [ ] > (
528
- [ ...newArchives . entries ( ) ] . map ( ( [ target , archive ] ) => {
529
- return [ target , archive . getEncodings ( ) ] ;
530
- } )
531
- ) ;
533
+ if ( this . arguments_ . metaComments ) {
534
+ const metaCommenter = new MetaCommenter (
535
+ this . userInterface ,
536
+ secondaryObjectives ,
537
+ objectives
538
+ ) ;
539
+ const start = Date . now ( ) ;
540
+ JavaScriptLauncher . LOGGER . info ( "Meta-Commenting started" ) ;
541
+ finalEncodings = await metaCommenter . execute ( finalEncodings ) ;
542
+ const timeInMs = ( Date . now ( ) - start ) / 1000 ;
543
+
544
+ JavaScriptLauncher . LOGGER . info ( `Meta-Commenting done took: ${ timeInMs } ` ) ;
545
+ this . userInterface . printSuccess ( `Meta-Commenting done took: ${ timeInMs } ` ) ;
546
+ }
532
547
533
548
const suiteBuilder = new JavaScriptSuiteBuilder (
534
549
this . storageManager ,
0 commit comments