Skip to content

💥✨ Add include/exclude cli-snapshot options & deprecate files/ignore #498

Merged
wwilsman merged 3 commits intomasterfrom
ww/snapshot-include-exclude
Aug 18, 2021
Merged

💥✨ Add include/exclude cli-snapshot options & deprecate files/ignore #498
wwilsman merged 3 commits intomasterfrom
ww/snapshot-include-exclude

Conversation

@wwilsman
Copy link
Copy Markdown
Contributor

@wwilsman wwilsman commented Aug 13, 2021

What is this?

This PR brings more robust filtering options to the percy snaphot command!

Building off of the recent work around adding deprecation utils and fixing various small bugs, both the previous files and ignore flags are now deprecated and will log as such. The preferred options are now include and exclude.

These new options are more than just a name change. The flags also work for filtering lists of snapshots when using a single file with the snapshot command. Plus, in addition to the existing glob support, the new options also allow filtering using a regular expression, a regex-like string pattern, or even a filter function. Snapshot list files can now also accept top-level include, exclude, and base-url options.

The static snapshots method previously passed all files and ignore options to globby. Now, it will only pass include and exclude to globby if said options only contain strings. All include and exclude options will continue to be passed along to the static mapping util where new filter logic is used.

The tests for the snapshot command were also split up into dedicated files covering each functionality of the command. A base test suite for common features, a directory suite for static features, and a file suite for snapshot listing features.

Slightly related — while refactoring a portion of the snapshot command, references to "pages" were replaced with references to "snapshots" instead. Since the merger of core #capture() and #snapshot() methods, the distinction is moot. Other small naming changes were made as well in reference to internal methods and utils.

@wwilsman wwilsman added ✨ enhancement New feature or request 💥 breaking Breaking change labels Aug 13, 2021
@wwilsman wwilsman requested a review from Robdel12 August 13, 2021 23:06
@wwilsman wwilsman enabled auto-merge (squash) August 13, 2021 23:16
@wwilsman wwilsman disabled auto-merge August 14, 2021 01:05
@Robdel12
Copy link
Copy Markdown
Contributor

Is the todo for this PR or a follow up task? We have to update docs.percy.io too

@Robdel12
Copy link
Copy Markdown
Contributor

The amount of times I type that is too much. We need to build docs from source 😩

@wwilsman
Copy link
Copy Markdown
Contributor Author

Both. I need to update the readme for this PR and also the docs site

The `files` and `ignore` options were static snapshot only options, while the new `include` and
`exclude` options will work for both static snapshots and snapshot list files. These two new options
also accept string patterns, regular expressions, and functions, in addition to globs.

References to "pages" were replaced with references to "snapshots" instead. Since the merger of core
`#capture()` and `#snapshot()` methods, the distinction is moot. Other small naming changes were
made as well in reference to internal methods and utils.

The static snapshots method will now only pass strings to globby, while continuing to pass all
include/exclude options on to the static mapping util. Snapshot list files can now also accept
top-level include, exclude, and base-url options.
@wwilsman wwilsman force-pushed the ww/snapshot-include-exclude branch from b3d563c to 1ab58f0 Compare August 18, 2021 20:30
@wwilsman
Copy link
Copy Markdown
Contributor Author

Readme here updated. Docs site will be updated along with the next release

@wwilsman wwilsman requested review from Robdel12 and removed request for Robdel12 August 18, 2021 20:41
Copy link
Copy Markdown
Contributor

@Robdel12 Robdel12 left a comment

Choose a reason for hiding this comment

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

🔥 🏁 Just keeps getting better

@wwilsman wwilsman merged commit b069b69 into master Aug 18, 2021
@wwilsman wwilsman deleted the ww/snapshot-include-exclude branch August 18, 2021 20:54
samarsault pushed a commit that referenced this pull request Mar 3, 2023
Bumps [@percy/core](https://github.com/percy/cli/tree/HEAD/packages/core) from 1.1.0 to 1.1.2.
- [Release notes](https://github.com/percy/cli/releases)
- [Commits](https://github.com/percy/cli/commits/v1.1.2/packages/core)

---
updated-dependencies:
- dependency-name: "@percy/core"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💥 breaking Breaking change ✨ enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants