File tree Expand file tree Collapse file tree
test/jest/acceptance/snyk-container Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -462,6 +462,30 @@ DepGraph end`,
462462 expect ( stderr ) . not . toContain ( 'Cannot read properties of undefined' ) ;
463463 expect ( stderr ) . not . toContain ( "reading 'created'" ) ;
464464 } ) ;
465+
466+ it ( 'detects sub-packages in n8n container image' , async ( ) => {
467+ const { code, stdout } = await runSnykCLI (
468+ `container test n8nio/n8n:1.120.3 --json` ,
469+ ) ;
470+
471+ const jsonOutput = JSON . parse ( stdout ) ;
472+ // Exit code can be 0 (no vulns) or 1 (vulns found), both are valid
473+ expect ( [ 0 , 1 ] ) . toContain ( code ) ;
474+
475+ expect ( jsonOutput ) . toBeDefined ( ) ;
476+ expect ( jsonOutput . applications ) . toBeDefined ( ) ;
477+ expect ( Array . isArray ( jsonOutput . applications ) ) . toBe ( true ) ;
478+ expect ( jsonOutput . applications . length ) . toBeGreaterThan ( 0 ) ;
479+
480+ // make sure that sub-packages are detected in the scan
481+ // n8n-nodes-langchain should be discovered as a sub-package of n8n
482+ const langchainApp = jsonOutput . applications . find (
483+ ( app ) =>
484+ app . targetFile ?. includes ( 'n8n-nodes-langchain' ) ||
485+ app . depTree ?. name ?. includes ( 'n8n-nodes-langchain' ) ,
486+ ) ;
487+ expect ( langchainApp ) . toBeDefined ( ) ;
488+ } , 180000 ) ;
465489 } ) ;
466490
467491 describe ( 'depgraph' , ( ) => {
You can’t perform that action at this time.
0 commit comments