Skip to content

✨ Add --debug discovery flag#492

Merged
wwilsman merged 4 commits intomasterfrom
ww/core-skip-uploads
Aug 12, 2021
Merged

✨ Add --debug discovery flag#492
wwilsman merged 4 commits intomasterfrom
ww/core-skip-uploads

Conversation

@wwilsman
Copy link
Copy Markdown
Contributor

What is this?

Asset discovery issues are typically debugged with the --verbose flag, or by setting the environment variable PERCY_LOGLEVEL=debug. While this option prints detailed logs throughout the toolchain, including asset discovery, it only does just that — prints detailed logs. However, when debugging asset discovery issues, the constant uploading of any snapshots results in a hit to screenshot usage. It would be beneficial while debugging asset discovery issues to simply not send any snapshots at all, or not even create a build to begin with.

This PR introduces a --debug flag, which not only enables debug logs just like the --verbose flag, but additionally disables snapshot uploads via a new core skipUploads option. This option mirrors the existing (but unused) deferUploads option. The two options do the same thing, with the addition of the skipUploads option skipping the deferred uploads altogether. The --debug flag could also be an entrypoint for future asset discovery debugging features.

The start() method was adjusted slightly to remove the Percy token check. This token doesn't need to be set when not uploading snapshots or creating builds. The token is also checked before any API call by client, such as the first task of the start() method, creating a build; this check is also already deferred when uploads are deferred. The creation of the deferred task was also moved outside of the try-catch block since there is nothing to catch until the task is run and awaited on.

This particular piece of code will not throw an error since it is not awaited on until later, still
within the try-catch block
@wwilsman wwilsman added the ✨ enhancement New feature or request label Aug 12, 2021
@wwilsman wwilsman requested a review from Robdel12 August 12, 2021 20:52
Comment on lines +17 to +18
if (flags.debug) level = 'debug';
else if (flags.verbose) level = 'debug';
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Kept these as separate checks in case we ever decide that one of these should produce even more logs

jasmine.stringMatching('Warn log \\(\\dms\\)'),
jasmine.stringMatching('Error log \\(\\dms\\)'),
jasmine.stringMatching('Debug log \\((9[0-9]|1[01][0-9])ms\\)'),
jasmine.stringMatching('Debug log \\(\\d{2,3}ms\\)'),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🚩 Flake

@wwilsman wwilsman enabled auto-merge (squash) August 12, 2021 20:57
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.

🏁 This makes my heart happy -- now we can start writing some docs on how to debug. 💯

@wwilsman wwilsman merged commit feecfde into master Aug 12, 2021
@wwilsman wwilsman deleted the ww/core-skip-uploads branch August 12, 2021 21:21
samarsault pushed a commit that referenced this pull request Mar 3, 2023
Bumps [cypress](https://github.com/cypress-io/cypress) from 9.5.3 to 9.5.4.
- [Release notes](https://github.com/cypress-io/cypress/releases)
- [Changelog](https://github.com/cypress-io/cypress/blob/develop/.releaserc.base.js)
- [Commits](cypress-io/cypress@v9.5.3...v9.5.4)

---
updated-dependencies:
- dependency-name: cypress
  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

✨ enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants