-
-
Notifications
You must be signed in to change notification settings - Fork 460
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
Show console.warn only in production #220
base: master
Are you sure you want to change the base?
Conversation
Why is your code loading PubSub more than once in node? Can you give a usage example that reproduces the undesirable behaviour? |
@mroderick @okletstryit FWIW, we are also seeing the We don't see the Generally, the warning is logged roughly once per test file in consuming applications, which adds quite a lot of unnecessary/unwanted noise in our test output, and makes it appear as if there may be something wrong with the components we are testing even though they are passing tests, e.g:
and
We've done some initial investigation here: openedx/wg-frontend#124 |
@mroderick, @okletstryit, friendly ping on Adam's comment above. We'd appreciate any help. Thanks! |
Thank you for the PR and the discussion. I'm not sure that silencing the warning if running in non-production node environments is the appropriate solution. That will likely cause people to overlook this warning, which is meant to help them detect silly situations BEFORE they get to production. I can imagine a few other solutions:
Have you considered if solutions like that are appropriate for your scenario? |
@mroderick Thanks for the feedback and alternative solutions!
I tried this by modifying the package's code in
This would likely be a viable solution, where we could set such an environment variable in our setupTest.js file for Jest in our shared frontend config and have it apply to all our micro-frontends consuming that shared Jest config. Testing this approach locally seems to do the trick. We'd be happy to open a PR to this repo if you'd also sold on the approach to only call cc @arbrandes |
That would be much appreciated 👍 |
@mroderick here is a PR to conditionally call the console.warn based on the environment variable: Feel free to review at your convenience. Thanks! |
make console.warn optional reading NODE_ENV variable (if exists). Show console.warn only in production.
The problem is that we log all console stuff to the logger and now we got thousands of useless messages there