Skip to content

test(scan): share default reachability options across tests - #1669

Merged
Oskar Haarklou Veileborg (BarrensZeppelin) merged 1 commit into
v1.xfrom
reach-default-options
Oct 29, 2026
Merged

Oskar Haarklou Veileborg (BarrensZeppelin) merged 1 commit into
v1.xfrom
reach-default-options

Conversation

@BarrensZeppelin

@BarrensZeppelin Oskar Haarklou Veileborg (BarrensZeppelin) commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Every reachability test spelled out each ReachabilityOptions field, so adding a reach flag (as in #1668) meant editing about 17 test literals. This adds makeReachabilityOptions() in test/reachability-options.mts, with values that mirror the CLI flag defaults. Tests now spread it and set only the fields they exercise. A new flag needs a default in this helper plus the two production literals in handle-ci.mts and create-scan-from-github.mts.

Test-only change. perform-reachability-analysis.test.mts used to pass memory limit '' and concurrency 0, and now gets '8192' and 1; none of its assertions depend on them. Test files aren't type-checked, so leaving a new flag out of the helper won't be caught, but the missing boolean is undefined and behaves as off.

Expected reviewer effort: Stamp


Note

Low Risk
Test-only refactor with no production code changes; default option values in one test file shifted but are unused by assertions.

Overview
Introduces makeReachabilityOptions() in test/reachability-options.mts, returning ReachabilityOptions defaults aligned with CLI flag defaults. Scan reachability tests no longer inline ~20 fields per fixture; they spread the helper and override only what each case exercises.

Removes duplicate local helpers (makeReachOptions in exclude-paths.test.mts, inline factories in perform-reachability-analysis.test.mts) and updates exclude-paths, handle-create-new-scan, handle-scan-reach, perform-reachability-analysis, and generate-uv-member-sboms e2e tests accordingly. perform-reachability-analysis.test.mts now gets memory limit '8192' and concurrency 1 instead of '' and 0; assertions there do not depend on those values.

Reviewed by Cursor Bugbot for commit 2ed6f8d. Configure here.

Each test spelled out every ReachabilityOptions field, so adding a reach
flag meant editing about 17 literals. Tests now spread
makeReachabilityOptions() and set only the fields they exercise.

@mtorp Martin Torp (mtorp) 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.

Nice!

@BarrensZeppelin
Oskar Haarklou Veileborg (BarrensZeppelin) merged commit d2106e1 into v1.x Oct 29, 2026
11 checks passed
@BarrensZeppelin
Oskar Haarklou Veileborg (BarrensZeppelin) deleted the reach-default-options branch October 29, 2026 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants