Skip to content

test: cover advisories init end to end#852

Open
lntutor wants to merge 1 commit into
OWASP:mainfrom
lntutor:test/advisories-init-e2e-851
Open

test: cover advisories init end to end#852
lntutor wants to merge 1 commit into
OWASP:mainfrom
lntutor:test/advisories-init-e2e-851

Conversation

@lntutor

@lntutor lntutor commented Jul 19, 2026

Copy link
Copy Markdown

Summary

Adds end-to-end coverage for cve-lite advisories init through the real built CLI.

Closes #851

Why this change

The command had unit coverage but no test verifying its process exit codes and filesystem behavior through the distributed binary.

What changed

  • Run advisories init --output <temp path> and assert exit code 0.
  • Verify the requested database file is created.
  • Run the command again against the same path and assert exit code 1 with the overwrite error.

Validation

  • npm run build
  • node dist/index.js advisories sync
  • npm test -- --runInBand (94 suites, 1,096 tests)

User-facing impact

Does this change:

  • affect scanning behavior
  • affect output formatting
  • affect JSON output
  • affect docs only

Notes

Test-only change; production behavior is unchanged.

@lntutor
lntutor requested a review from sonukapoor as a code owner July 19, 2026 16:24

@ELHart05 ELHart05 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking this up. Reviewed the change and ran it locally against a synced advisory DB: the new test passes and the full e2e file stays green.

The scope is right. init has no network dependency, so it runs cleanly through the built binary, and you cover both exit-code paths: 0 with the file created on the first run, and 1 with the overwrite error on the second. It reuses the existing harness helpers and sits next to the other command tests. Reads well to me.

LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: add e2e coverage for the advisories init command

2 participants