@@ -141,6 +141,14 @@ export default class Runner {
141
141
}
142
142
143
143
addJourney ( journey : Journey ) {
144
+ const journeySuite = this . suites . get ( journey . location ) ;
145
+ if ( journeySuite ) {
146
+ journeySuite . addJourney ( journey ) ;
147
+ } else {
148
+ const suite = new Suite ( journey . location ) ;
149
+ suite . addJourney ( journey ) ;
150
+ this . addSuite ( suite ) ;
151
+ }
144
152
this . journeys . push ( journey ) ;
145
153
this . #currentJourney = journey ;
146
154
}
@@ -392,10 +400,13 @@ export default class Runner {
392
400
}
393
401
394
402
buildMonitors ( options : RunOptions ) {
403
+ /* Build out monitors according to matrix specs */
404
+ this . parseMatrix ( options ) ;
405
+
395
406
/**
396
407
* Update the global monitor configuration required for
397
408
* setting defaults
398
- */
409
+ */
399
410
this . updateMonitor ( {
400
411
throttling : options . throttling ,
401
412
schedule : options . schedule ,
@@ -407,24 +418,37 @@ export default class Runner {
407
418
408
419
const { match, tags } = options ;
409
420
const monitors : Monitor [ ] = [ ] ;
410
- for ( const journey of this . journeys ) {
421
+
422
+ const journeys = this . getAllJourneys ( ) ;
423
+
424
+ for ( const journey of journeys ) {
411
425
const params = Object . freeze ( { ...this . monitor . config ?. params , ...options . params , ...journey . params } ) ;
412
426
if ( ! journey . isMatch ( match , tags ) ) {
413
427
continue ;
414
428
}
429
+ console . warn ( 'journey.name' , journey . name ) ;
415
430
this . #currentJourney = journey ;
416
431
/**
417
432
* Execute dummy callback to get all monitor specific
418
433
* configurations for the current journey
419
434
*/
420
435
journey . callback ( { params : params } as any ) ;
436
+ console . warn ( 'journey.monitor.config' , journey . monitor . config ) ;
421
437
journey . monitor . update ( {
422
- ...this . monitor ?. config ,
438
+ ...this . monitor ?. config ,
423
439
params : Object . keys ( params ) . length ? params : undefined
424
440
} ) ;
441
+
442
+ /* Only overwrite name and id values when using matrix */
443
+ if ( journey . matrix ) {
444
+ journey . monitor . config . name = journey . name ;
445
+ journey . monitor . config . id = journey . id ;
446
+ }
447
+ console . warn ( 'journey.monitor.config2' , journey . monitor . config ) ;
425
448
journey . monitor . validate ( ) ;
426
449
monitors . push ( journey . monitor ) ;
427
450
}
451
+ // console.warn('monitors', monitors);
428
452
return monitors ;
429
453
}
430
454
@@ -453,11 +477,19 @@ export default class Runner {
453
477
j . name = name ;
454
478
j . id = name ;
455
479
j . params = matrixParams ;
480
+ j . matrix = matrix ;
456
481
this . addJourney ( j ) ;
457
482
suite . addJourney ( j ) ;
458
483
} ) ;
459
- } )
460
-
484
+ } )
485
+ }
486
+
487
+ getAllJourneys ( ) {
488
+ const journeys = Array . from ( this . suites . values ( ) ) . reduce ( ( acc , suite ) => {
489
+ const suiteJourneys = suite . entries ;
490
+ return [ ...acc , ...suiteJourneys ] ;
491
+ } , [ ] ) ;
492
+ return journeys ;
461
493
}
462
494
463
495
async run ( options : RunOptions ) {
@@ -477,10 +509,7 @@ export default class Runner {
477
509
478
510
this . parseMatrix ( options ) ;
479
511
480
- const journeys = Array . from ( this . suites . values ( ) ) . reduce ( ( acc , suite ) => {
481
- const suiteJourneys = suite . entries ;
482
- return [ ...acc , ...suiteJourneys ] ;
483
- } , [ ] ) ;
512
+ const journeys = this . getAllJourneys ( ) ;
484
513
485
514
for ( const journey of journeys ) {
486
515
/**
0 commit comments