Skip to content

Commit c791f70

Browse files
committed
fix: add test coverage for pnpm sub-dependencies
1 parent 778d68c commit c791f70

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

test/jest/acceptance/snyk-container/container.spec.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff 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', () => {

0 commit comments

Comments
 (0)