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

Loggers: Silence irrelevant error logs in unit tests #1345

Closed
adamziel opened this issue Apr 30, 2024 · 0 comments · Fixed by #1368
Closed

Loggers: Silence irrelevant error logs in unit tests #1345

adamziel opened this issue Apr 30, 2024 · 0 comments · Fixed by #1368

Comments

 @adamziel
Copy link
Collaborator

The amount of output makes the unit test log very difficult to reason about:

https://github.com/WordPress/wordpress-playground/actions/runs/8831432918/job/24246723178

 CleanShot 2024-04-30 at 12 10  51@2x

Let's silence all the expected logs and only let the test failures through. That probably involves emptying the log handlers array.

cc @bgrgicak

 @adamziel adamziel changed the title Loggers: Silence the error logs in unit tests Loggers: Silence irrelevant error logs in unit tests Apr 30, 2024
 @bgrgicak bgrgicak self-assigned this May 2, 2024
adamziel pushed a commit that referenced this issue May 7, 2024
 Fixes  #1345 ## What is this PR doing? It makes the output of logs cleaner by hiding logger output when running tests. ## What problem is it solving? All logger messages are currently displayed in the test run output which makes it hard to read. ## How is the problem addressed? By determining if the current environment is a test and if yes, logToConsole is disabled. This can still be overridden by manually initializing the logger. ## Testing Instructions - ensure all tests pass - check the unit test output and confirm there are no unwanted logs
Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants