Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add --debug discovery flag #492

Merged
merged 4 commits into from
Aug 12, 2021
Merged

✨ Add --debug discovery flag #492

merged 4 commits into from
Aug 12, 2021

Conversation

wwilsman
Copy link
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
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

@@ -267,7 +269,7 @@ describe('logger', () => {
expect(helpers.stderr).toEqual([
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
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
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