✨Add core option to skip asset discovery#1038
Merged
Conversation
This also removes the need to prevent a browser from launching when starting percy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this?
While asset discovery is usually necessary for taking DOM snapshots, sometimes we don't actually need to take DOM snapshots at all, such as with the
uploadcommand. For these circumstances, downloading a browser for asset discovery that won't ever be used is unnecessary.For the
uploadcommand, we currently have a 2-part approach to skipping asset discovery. First, we utilize a@percy/cli-commandspecific option,discoveryFlags, to suppress asset discovery flags from being accepted. Second, we provide thepercy.start()method with an option to skip launching a browser, which in-turn prevents the browser download completely.For future projects, this 2-part solution isn't possible, and even now seems like a workaround for a missing feature. This PR adds that missing feature: an option to skip asset discovery altogether with a new
skipDiscoverycore option.The new
skipDiscoveryoption actually works nicely with the existingdryRunoption. ThedryRunoption already skips asset discovery along with disabling uploads. With the newskipDiscoveryoption, some logic branches were changed from checking fordryRun. Now, besides a few specific places for logging,dryRunis equivalent toskipDiscovery && skipUploads.Extra logic was added to prevent snapshot captures when asset discovery is disabled since capturing the DOM requires a browser which
skipDiscoveryspecifically prevents from being launched. If any normal DOM snapshots are received, they simply bypass asset discovery completely.This option is not currently exposed publicly in any way. Only the
uploadcommand and specific future SDKs will utilize this feature internally.