@@ -122,14 +122,16 @@ describe("ComponentDetection.addPackagesToManifests", () => {
122122 expect ( manifests [ 0 ] . countDependencies ( ) ) . toBe ( 1 ) ;
123123 } ) ;
124124
125+ // Component detection reports some packages as top level referrers of themselves
126+ // We need to mark as direct as causes Dependency Graph to mark the package as transitive without any Direct
125127 test ( "adds package as indirect dependency when top level referrer is itself" , ( ) => {
126128 const manifests : any [ ] = [ ] ;
127129
128130 const testPackage = {
129131 id : "test-package" ,
130132 packageUrl : "pkg:npm/test-package@1.0.0" ,
131133 isDevelopmentDependency : false ,
132- topLevelReferrers : [ { packageUrl : "pkg:npm/test-package@1.0.0" } ] , // Self-reference case
134+ topLevelReferrers : [ { packageUrl : "pkg:npm/test-package@1.0.0" } ] ,
133135 locationsFoundAt : [ "package.json" ] ,
134136 containerDetailIds : [ ] ,
135137 containerLayerIds : [ ] ,
@@ -142,9 +144,8 @@ describe("ComponentDetection.addPackagesToManifests", () => {
142144 expect ( manifests ) . toHaveLength ( 1 ) ;
143145 expect ( manifests [ 0 ] . name ) . toBe ( "package.json" ) ;
144146
145- // Self-referencing packages are currently treated as indirect - this might be a bug to investigate
146- expect ( manifests [ 0 ] . directDependencies ( ) ) . toHaveLength ( 0 ) ;
147- expect ( manifests [ 0 ] . indirectDependencies ( ) ) . toHaveLength ( 1 ) ;
147+ expect ( manifests [ 0 ] . directDependencies ( ) ) . toHaveLength ( 1 ) ;
148+ expect ( manifests [ 0 ] . indirectDependencies ( ) ) . toHaveLength ( 0 ) ;
148149 expect ( manifests [ 0 ] . countDependencies ( ) ) . toBe ( 1 ) ;
149150 } ) ;
150151
0 commit comments