Skip to content

feat(snapshotting): Add module-based preview filtering#260

Merged
cameroncooke merged 1 commit into
mainfrom
cameroncooke/eme-1043-openai-requestsnapshotpreviews-add-includedexcluded-previews
Apr 29, 2026
Merged

feat(snapshotting): Add module-based preview filtering#260
cameroncooke merged 1 commit into
mainfrom
cameroncooke/eme-1043-openai-requestsnapshotpreviews-add-includedexcluded-previews

Conversation

@cameroncooke
Copy link
Copy Markdown
Contributor

Add snapshotPreviewModules() and excludedSnapshotPreviewModules() overrides on the PreviewFilters protocol, plus matching SNAPSHOT_PREVIEW_MODULES / EXCLUDED_SNAPSHOT_PREVIEW_MODULES launch environment variables, so multi-module projects can opt previews in or out by module without enumerating every preview type.

Module names are matched exactly against the leading component of each preview type's fully-qualified name (e.g. MyModule in MyModule.MyView_Previews), giving a coarse-grained filter that mirrors how Swift namespaces previews. Inclusion and exclusion lists compose with the existing per-preview filters, and an empty list means "no filter" so existing consumers see no behavior change.

A new Examples/MultiModuleDemo project exercises the filters across three SwiftUI modules and pairs with ModuleFilterAssertionTests to verify the matching helpers under the documented launch-env scenarios. The README is updated to describe the new APIs and env vars.

Refs EME-1043

Allow consumers to include or exclude previews by module name via new
`snapshotPreviewModules()` and `excludedSnapshotPreviewModules()` overrides
on the `PreviewFilters` protocol, mirrored by `SNAPSHOT_PREVIEW_MODULES`
and `EXCLUDED_SNAPSHOT_PREVIEW_MODULES` launch environment variables.

Module names are matched exactly against the prefix of each preview type
name (e.g. "MyModule" in "MyModule.MyView_Previews"), giving multi-module
projects a coarse-grained filter without enumerating individual previews.

Add a MultiModuleDemo example covering the new filters and unit tests
for the module matching helpers.
@cameroncooke cameroncooke marked this pull request as ready for review April 27, 2026 18:21
@cameroncooke cameroncooke merged commit ee45c68 into main Apr 29, 2026
7 checks passed
@cameroncooke cameroncooke deleted the cameroncooke/eme-1043-openai-requestsnapshotpreviews-add-includedexcluded-previews branch April 29, 2026 09:08
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.

2 participants