Skip to content

feat: add shared test targets to impact selection#18

Closed
V3RON wants to merge 1 commit into
masterfrom
feat/shared-targets
Closed

feat: add shared test targets to impact selection#18
V3RON wants to merge 1 commit into
masterfrom
feat/shared-targets

Conversation

@V3RON

@V3RON V3RON commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

What is this?

This PR adds tests.sharedTargets, a config field for source targets that should apply to every test map entry. It covers shared setup modules that reach into the rest of the app so Sniffler can still consider every affected test when those modules change.

How does it work?

Sniffler now validates tests.sharedTargets as a string array and defaults it to [] for backward compatibility. During impact selection, it loads the test map as before, then appends the shared targets to each test entry before matching against the dependency graph. Matching still uses the graph and existing exact/glob semantics, so a change in src/some-other.ts can select tests through the path src/some-other.ts -> src/global.ts without bypassing traversal.

Why is this useful?

This keeps global setup files in the normal impact-analysis flow instead of special-casing them.

  • Tests that depend on shared setup stay selected when transitive dependencies change.
  • Config stays backward compatible and explicit.
  • The selector still benefits from graph analysis, so reason output stays consistent and debuggable.
  • The benchmark stayed in the same range on the current corpus (shared-root [1441 files]: 41.5543 hz, deep-branch [1441 files]: 84.3298 hz), which suggests the shared-target expansion does not add a new hot path.

Append sharedTargets to every test entry before impact matching and validate config input.
@V3RON V3RON closed this Jun 26, 2026
@V3RON V3RON deleted the feat/shared-targets branch June 26, 2026 09:33
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.

1 participant