@@ -212,55 +212,56 @@ describe('normalizeDependencyGraphPaths with real output.json', () => {
212212 expect ( key ) . not . toMatch ( / ^ \w : \\ | ^ \/ \/ | ^ \. { 1 , 2 } \/ / ) ; // Not windows absolute, not network, not relative
213213 }
214214 } ) ;
215+ } ) ;
215216
216- test ( 'full action scan creates manifests with correct names and file source locations' , async ( ) => {
217- const manifests = await ComponentDetection . scanAndGetManifests ( './test' ) ;
217+ test ( 'full action scan creates manifests with correct names and file source locations' , async ( ) => {
218+ await ComponentDetection . downloadLatestRelease ( ) ;
219+ const manifests = await ComponentDetection . scanAndGetManifests ( './test' ) ;
218220
219- expect ( manifests ) . toBeDefined ( ) ;
220- expect ( manifests ! . length ) . toBeGreaterThan ( 0 ) ;
221+ expect ( manifests ) . toBeDefined ( ) ;
222+ expect ( manifests ! . length ) . toBeGreaterThan ( 0 ) ;
221223
222- // Ensure no manifest names have leading slashes
223- for ( const manifest of manifests ! ) {
224- expect ( manifest . name . startsWith ( '/' ) ) . toBe ( false ) ;
225- }
224+ // Ensure no manifest names have leading slashes
225+ for ( const manifest of manifests ! ) {
226+ expect ( manifest . name . startsWith ( '/' ) ) . toBe ( false ) ;
227+ }
226228
227- const expectedManifestNames = [
228- 'package.json' ,
229- 'package-lock.json' ,
230- 'nested/package.json' ,
231- 'nested/package-lock.json' ,
232- 'environment.yaml'
233- ] ;
229+ const expectedManifestNames = [
230+ 'package.json' ,
231+ 'package-lock.json' ,
232+ 'nested/package.json' ,
233+ 'nested/package-lock.json' ,
234+ 'environment.yaml'
235+ ] ;
234236
235- // Create a lookup for manifests by name
236- const manifestsByName = manifests ! . reduce ( ( acc , manifest ) => {
237- acc [ manifest . name ] = manifest ;
238- return acc ;
239- } , { } as Record < string , any > ) ;
237+ // Create a lookup for manifests by name
238+ const manifestsByName = manifests ! . reduce ( ( acc , manifest ) => {
239+ acc [ manifest . name ] = manifest ;
240+ return acc ;
241+ } , { } as Record < string , any > ) ;
240242
241- // Check each expected manifest if it exists
242- for ( const expectedName of expectedManifestNames ) {
243- const manifest = manifestsByName [ expectedName ] ;
244- if ( manifest ) {
245- expect ( manifest . name ) . toBe ( expectedName ) ;
246- expect ( manifest . file ?. source_location ) . toBe ( expectedName ) ;
247- }
243+ // Check each expected manifest if it exists
244+ for ( const expectedName of expectedManifestNames ) {
245+ const manifest = manifestsByName [ expectedName ] ;
246+ if ( manifest ) {
247+ expect ( manifest . name ) . toBe ( expectedName ) ;
248+ expect ( manifest . file ?. source_location ) . toBe ( expectedName ) ;
248249 }
250+ }
249251
250- // Verify specific expected manifests exist with correct properties
251- if ( manifestsByName [ 'package.json' ] ) {
252- expect ( manifestsByName [ 'package.json' ] . name ) . toBe ( 'package.json' ) ;
253- expect ( manifestsByName [ 'package.json' ] . file ?. source_location ) . toBe ( 'package.json' ) ;
254- }
252+ // Verify specific expected manifests exist with correct properties
253+ if ( manifestsByName [ 'package.json' ] ) {
254+ expect ( manifestsByName [ 'package.json' ] . name ) . toBe ( 'package.json' ) ;
255+ expect ( manifestsByName [ 'package.json' ] . file ?. source_location ) . toBe ( 'package.json' ) ;
256+ }
255257
256- if ( manifestsByName [ 'nested/package.json' ] ) {
257- expect ( manifestsByName [ 'nested/package.json' ] . name ) . toBe ( 'nested/package.json' ) ;
258- expect ( manifestsByName [ 'nested/package.json' ] . file ?. source_location ) . toBe ( 'nested/package.json' ) ;
259- }
258+ if ( manifestsByName [ 'nested/package.json' ] ) {
259+ expect ( manifestsByName [ 'nested/package.json' ] . name ) . toBe ( 'nested/package.json' ) ;
260+ expect ( manifestsByName [ 'nested/package.json' ] . file ?. source_location ) . toBe ( 'nested/package.json' ) ;
261+ }
260262
261- if ( manifestsByName [ 'environment.yaml' ] ) {
262- expect ( manifestsByName [ 'environment.yaml' ] . name ) . toBe ( 'environment.yaml' ) ;
263- expect ( manifestsByName [ 'environment.yaml' ] . file ?. source_location ) . toBe ( 'environment.yaml' ) ;
264- }
265- } , 15000 ) ;
266- } ) ;
263+ if ( manifestsByName [ 'environment.yaml' ] ) {
264+ expect ( manifestsByName [ 'environment.yaml' ] . name ) . toBe ( 'environment.yaml' ) ;
265+ expect ( manifestsByName [ 'environment.yaml' ] . file ?. source_location ) . toBe ( 'environment.yaml' ) ;
266+ }
267+ } , 15000 ) ;
0 commit comments