File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,15 @@ function makeFakeChainDefinition(nodes: { [n: string]: any }) {
1212 _ . set ( rawDef , n , nodes [ n ] ) ;
1313 }
1414
15- return new ChainDefinition ( rawDef ) ;
15+ const def = new ChainDefinition ( rawDef ) ;
16+
17+ try {
18+ def . initializeComputedDependencies ( ) ;
19+ } catch {
20+ // no contents
21+ }
22+
23+ return def ;
1624}
1725
1826describe ( 'ChainDefinition' , ( ) => {
Original file line number Diff line number Diff line change @@ -343,6 +343,11 @@ export class ChainDefinition {
343343
344344 computeDepsDebug ( 'finished compute dependencies' ) ;
345345
346+ const cycles = this . checkCycles ( ) ;
347+ if ( cycles ?. length ) {
348+ throw new Error ( `cannot generate dependency tree: dependency cycle found: ${ cycles . join ( ' => ' ) } ` ) ;
349+ }
350+
346351 this . _roots = new Set ( this . allActionNames . filter ( ( n ) => ! this . getDependencies ( n ) . length ) ) ;
347352
348353 if ( computeDepsDebug . enabled ) {
@@ -482,8 +487,6 @@ export class ChainDefinition {
482487 currentPath = new Set < string > ( )
483488 ) : string [ ] | null {
484489 // resolved dependencies gets set during dependency computation
485- this . initializeComputedDependencies ( ) ;
486-
487490 for ( const n of actions ) {
488491 if ( seenNodes . has ( n ) ) {
489492 return null ;
You can’t perform that action at this time.
0 commit comments