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

chore: deal with jest console warnings #3410

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Robert-LC
Copy link
Contributor

PR Checklist

PR Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Developer experience (improves developer workflows for contributing to the project)

Description

I dealt with most of the Jest console warnings as well as the unnecessary logging appearing.

  • For logger itself, I expected the test log entries of debug, info, warn, fatal instead of displaying them.

  • For Message.store.tsx I removed the logger.error calls because the test looks for Errors thrown so no need to cloud the logging, if the tests will fail in that regard.

  • For files that called logger.info, I switched to logger.debug instead to hide the calls in the tests, but keep them around for debugging. Let me know if you think this what the right choice for those items.

  • There were a few tests like in user.store.test.tsx where it was testing for if two users were returned form the same id and it would return a warning, but if it wouldn't cause a failure of the test.

So for those type of scenarios, I decided to mock the warning to hide from the test suite, since its not failing on expect. Let me know if you want something different in that scenario.

Lastly, while trying to figure out the best approach, I noticed that in functions/src/test/firebase/logger.ts there was at one point a top level mock that spied on all firebase logger methods

Git Issues

Closes #3303

@Robert-LC Robert-LC requested a review from a team as a code owner April 2, 2024 20:11
Copy link

cypress bot commented Apr 2, 2024

1 failed test on run #5361 ↗︎

1 97 0 0 Flakiness 0

Details:

chore: deal with jest console warnings
Project: onearmy-community-platform Commit: 7315692b72
Status: Failed Duration: 04:36 💡
Started: Apr 2, 2024 8:23 PM Ended: Apr 2, 2024 8:28 PM
Failed  src/integration/settings.spec.ts • 1 failed test • ci-chrome

View Output Video

Test Artifacts
[Settings] > [All account types > [Can update username and password] Test Replay Screenshots Video

Review all test suite changes for PR #3410 ↗︎

Copy link
Member

@benfurber benfurber left a comment

Choose a reason for hiding this comment

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

Thanks for your patience waiting to hear back on this one. Does it solve all the console logging stuff?

Copy link
Member

Choose a reason for hiding this comment

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

Disagree with this change. logger is doing what it should be here.

Copy link
Member

Choose a reason for hiding this comment

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

Rather than mocking logger, the tests should be anticipating the call to logger happening.
https://stackoverflow.com/questions/49096093/how-do-i-test-a-jest-console-log

Copy link
Member

Choose a reason for hiding this comment

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

Rather than mocking logger, the tests should be anticipating the call to logger happening.
https://stackoverflow.com/questions/49096093/how-do-i-test-a-jest-console-log

@benfurber
Copy link
Member

Hey @Robert-LC hope you're well, will you have a chance to have a look at this again soon?

@benfurber benfurber added the 🤝 Awaiting author Waiting on action from the author label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤝 Awaiting author Waiting on action from the author Mod: Research 🔬
Projects
Status: No status
Status: 💬 Changes Requested
Development

Successfully merging this pull request may close these issues.

Deal with all the jest console warnings
2 participants