-
-
Notifications
You must be signed in to change notification settings - Fork 634
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
Many "Inferno is in development mode" logs during testing #1573
Comments
Hi I think you have something wrong in your test suite build if you see more than one message it means you have more than one infernojs bundled in your javascript bundle. Is that intentional? |
I have this |
what about disabling the console log then?
|
Monkey patching? I once did this and then lost some valuable data in tests. It was my bad, should never rely on Is there a need for displaying this message? I understand and appreciate that the library displays |
It is valuable information because people do bundling mistakes and then report issues to inferno saying its slow or post benchmarks to internet and don't even use optimized version, well yeah its slow if the build is not even in production mode. |
Understandable. I suppose that wrapping this |
Okay sure, would you like to send PR? |
Simple fix suggested by @igvnv infernojs#1573 (comment) This should cleanup console output during jest test run. Jest runner ensure that `process.env.NODE_ENV` is set to `test`
hi @Havunen, sorry to necrobump this, I ran into the same issue, in my case however i'm not using I was wondering if you would be open for a PR which "generalizes" this warning-skipping logic to cover both |
Sounds good to me as long as the code can be treeshaken off from the production bundle |
* adds checking of variable `SKIP_INFERNO_WARNINGS` to skip warnings in non-production mode * `SKIP_INFERNO_WARNINGS` can be also declared globally for browser functionality, or just defined on the process.env in case of node * FYI: JEST related warning skip about development mode was removed with 2ed75dc when fixing #1582, only the skipping of minified code warning was in place
Probably there are good reasons for the message but here they seem to be the wrong solution for whatever problem is resolved. Why would a package ship with "development" mode as default rather than opt-in behaviour? Runtime configurable settings would be more user-friendly, eg |
The reasoning is following: if you start developing new application and you are new to infernojs. If it would have production mode enabled, then you will not see any of the warnings produced by the development time validations and you may encounter very weird behavior. For example using duplicate "key" wouldnt produce error, or missing "key" could go into production unnoticed. |
Observed Behaviour
When running tests that utilize Inferno as part of the framework, every test will log
Inferno is in development mode.
to the console. This is due to theNODE_ENV !== 'production'
check inindex.ts
within Inferno.This logging behavior, without an ability to stop it, pollutes test logs with these statements.
Expected Current Behaviour
I don't know if there's an exact specified behavior. Having a way to turn off these logs (without setting the whole process to 'production') would be helpful.
If this is a design choice, the options as far as I can tell are to:
console.log
to avoid extra loggingA few of the above are non-ideal, and I would argue switching test suite to production is just a bad idea.
Ideally, I think that an environment variable or environment detection makes the most sense.
The text was updated successfully, but these errors were encountered: