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

refactor: move console logging out of run.ts #23555

Merged
merged 4 commits into from
Aug 29, 2022
Merged

Conversation

flotwig
Copy link
Contributor

@flotwig flotwig commented Aug 25, 2022

  • Closes

User facing changelog

Additional details

  • Makes run.ts easier to work on by factoring out all of the complicated display logic. Now run.ts is a measly ~1100 lines long, down from ~1700!

Steps to test

How has the user experience changed?

PR Tasks

  • [na] Have tests been added/updated?
    • Existing snapshot coverage should not change.
  • [na] Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • [na] Has a PR for user-facing changes been opened in cypress-documentation?
  • [na] Have API changes been updated in the type definitions?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 25, 2022

Thanks for taking the time to open a PR!

@cypress
Copy link

cypress bot commented Aug 25, 2022



Test summary

39609 0 3371 0Flakiness 0


Run details

Project cypress
Status Passed
Commit e0aeb06
Started Aug 26, 2022 8:13 PM
Ended Aug 26, 2022 8:27 PM
Duration 14:11 💡
OS Linux Debian - 11.3
Browser Multiple

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@flotwig flotwig marked this pull request as ready for review August 25, 2022 21:41
return `${color(name, colour)}`
}

function formatNodeVersion ({ resolvedNodeVersion, resolvedNodePath }: Pick<Cfg, 'resolvedNodeVersion' | 'resolvedNodePath'>, width) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we split out / add the appropriate unit tests for this? The snapshots exist but are more a side-effect of other aspects vs explicitly testing these.

Also is it possible to fully type this new file verse adding partial types?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The goal of this PR is to just split out some LoC from run.ts to make it easier to work in.

All of the modes/run.js unit tests were removed during unification, so there is not currently any unit-level testing for this logic. There's a ton of logic in here that would be helpful to have unit tests for, but since we already have coverage for this in the form of system-test snapshots, I don't feel it's particularly important to add in this PR, since it has survived without unit tests for this long.

I added more types to make this area easier to work in: e0aeb06 I started trying to type the results object, but it turned into a rabbithole, it's overloaded with 3 separate result types (Mocha end, early exit, and dashboard skip), properly typing it would require either a refactor or a lot of falsy checks.

Copy link
Contributor

@tbiethman tbiethman left a comment

Choose a reason for hiding this comment

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

👍 👍

@flotwig flotwig changed the title chore: factor console logging out of run.ts refactor: move console logging out of run.ts Aug 29, 2022
@flotwig flotwig merged commit 4871ebc into develop Aug 29, 2022
@flotwig flotwig deleted the extract-logging-from-run branch August 29, 2022 19:06
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.

None yet

5 participants