Skip to content

chore: seeded fixture DB for deterministic e2e tests#833

Merged
sonukapoor merged 3 commits into
mainfrom
feature/issue-734-seeded-fixture-db
Jul 14, 2026
Merged

chore: seeded fixture DB for deterministic e2e tests#833
sonukapoor merged 3 commits into
mainfrom
feature/issue-734-seeded-fixture-db

Conversation

@sonukapoor

Copy link
Copy Markdown
Collaborator

Closes #734

Adds a small seeded advisory DB and scenario library so e2e tests run deterministically without a live OSV network sync. A fresh checkout now passes all seeded tests out of the box.

What's included:

  • scripts/build-fixture-db.mjs - builds tests/fixtures/advisories/seeded.db from the advisory entries in each scenario directory
  • tests/e2e/global-setup.mjs - extended to rebuild the seeded DB automatically when any scenario.json is newer than the DB
  • tests/e2e/harness.ts - exports SEEDED_DB and SCENARIOS constants
  • examples/scenarios/ - three scenario directories with fictional package names (cve-lite-scenario-*) that will never match live OSV advisories: direct-high, transitive-only, no-findings
  • tests/e2e/seeded-db.test.ts - network-free e2e suite covering direct detection, fail-on exit codes, transitive detection, clean exit 0, and synthetic harness projects via --offline-db
  • .gitignore - adds tests/fixtures/advisories/seeded.db (generated binary) and cve-lite-overrides-*.json (overrides command output)
  • package.json - adds build:fixture-db script for manual rebuilds

The seeded DB is git-ignored and rebuilt automatically by Jest globalSetup, so no binary is committed. Adding a new scenario is just adding a directory with scenario.json - no manual DB editing required.

Adds build-fixture-db.mjs script and wires it into Jest globalSetup so
the seeded advisory DB is rebuilt automatically whenever any scenario.json
changes. Exports SEEDED_DB and SCENARIOS constants from the harness.
Gitignores the generated seeded.db and overrides output JSON files.
Adds a build:fixture-db npm script for manual rebuilds.
…734)

Three scenarios covering the core finding shapes: direct-high (one direct
dep, fix available), transitive-only (transitive dep, no fix), and
no-findings (clean project). Each uses fictional package names so results
never drift when live OSV advisories change.
Network-free e2e tests backed by the seeded advisory DB. Covers: direct
high-severity detection, fail-on exit code, transitive medium-severity
detection, clean project exit 0, and synthetic harness projects. All
tests use --offline-db so results are deterministic and never drift with
live OSV data.
@sonukapoor sonukapoor merged commit 9d3a21a into main Jul 14, 2026
6 checks passed
@sonukapoor sonukapoor deleted the feature/issue-734-seeded-fixture-db branch July 14, 2026 12:29
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.

chore: seeded fixture DB for deterministic e2e tests and scenario library

1 participant