@@ -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,7 +418,10 @@ 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 ;
@@ -419,9 +433,15 @@ export default class Runner {
419
433
*/
420
434
journey . callback ( { params : params } as any ) ;
421
435
journey . monitor . update ( {
422
- ...this . monitor ?. config ,
436
+ ...this . monitor ?. config ,
423
437
params : Object . keys ( params ) . length ? params : undefined
424
438
} ) ;
439
+
440
+ /* Only overwrite name and id values when using matrix */
441
+ if ( journey . matrix ) {
442
+ journey . monitor . config . name = journey . name ;
443
+ journey . monitor . config . id = journey . id ;
444
+ }
425
445
journey . monitor . validate ( ) ;
426
446
monitors . push ( journey . monitor ) ;
427
447
}
@@ -453,11 +473,19 @@ export default class Runner {
453
473
j . name = name ;
454
474
j . id = name ;
455
475
j . params = matrixParams ;
476
+ j . matrix = matrix ;
456
477
this . addJourney ( j ) ;
457
478
suite . addJourney ( j ) ;
458
479
} ) ;
459
- } )
460
-
480
+ } )
481
+ }
482
+
483
+ getAllJourneys ( ) {
484
+ const journeys = Array . from ( this . suites . values ( ) ) . reduce ( ( acc , suite ) => {
485
+ const suiteJourneys = suite . entries ;
486
+ return [ ...acc , ...suiteJourneys ] ;
487
+ } , [ ] ) ;
488
+ return journeys ;
461
489
}
462
490
463
491
async run ( options : RunOptions ) {
@@ -477,10 +505,7 @@ export default class Runner {
477
505
478
506
this . parseMatrix ( options ) ;
479
507
480
- const journeys = Array . from ( this . suites . values ( ) ) . reduce ( ( acc , suite ) => {
481
- const suiteJourneys = suite . entries ;
482
- return [ ...acc , ...suiteJourneys ] ;
483
- } , [ ] ) ;
508
+ const journeys = this . getAllJourneys ( ) ;
484
509
485
510
for ( const journey of journeys ) {
486
511
/**
0 commit comments