-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Since v0.34.2 "Download the React DevTools" message displayed in every test #4107
Comments
Looking into this in more detail: https://github.com/facebook/react/blob/main/packages/react-dom/src/client/ReactDOM.js#L208 shows the code in React that generates the message. There are 2 relevant checks: the Using jsdom never triggers this, because it will cause the userAgent to be something like "Mozilla/5.0 (linux) AppleWebKit/537.36 (KHTML, like Gecko) jsdom/22.1.0" - this does not contain "Chrome" or "Firefox" so is ignored. When using happy-dom, the userAgent is like "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:97.0) Gecko/20100101 Firefox/97.0" - it has Firefox in it so will trigger it. (capricorn86/happy-dom#482) However, in vitest 0.34.1, In vitest 0.34.2 this is now "http:" (which seems like a reasonable change), so its no longer ignored. Not sure what actually caused that change though. So not sure if this is really a vitest issue, its either a happy-dom issue or a react issue. |
From your investigations, it looks like this is not an issue. React does what it was told to do. If you want to silence a console, you can return |
I fixed this by creating a new setup file containing: Object.defineProperty(globalThis, '__REACT_DEVTOOLS_GLOBAL_HOOK__', { value: { isDisabled: true } }) That file was added as the first entry in ( |
Brilliant, thank you. |
There is an issue for this in Happy DOM now: |
This has now been fixed in Happy DOM v12. |
Describe the bug
Note sure if this is a bug exactly, but it does not seem intention. Happy to move this to a discussion instead though.
After upgrading to v0.34.2 (from v0.34.1), every test file is generating is causing the following output:
This seems to be to related to this issue with React 18: facebook/react#24283 However for me its fine in browser, only an issue in the tests.
I found that it is specific to the happy-dom environment. Changing to jsdom prevents it from being displayed. I suspect it is something to do with passing environment options to happy-dom, a change mentioned in the release notes for 0.34.2.
Reproduction
React 18
[email protected]
[email protected]
[email protected] (downgrading this made no difference for me)
@testing-library/[email protected]
@testing-library/[email protected]
@testing-library/[email protected]
@vitejs/[email protected]
Running any test of a react component trigger it.
Its not for every test, just for every time. Hence the "stdout | unknown test" part I assume.
System Info
Used Package Manager
yarn
Validations
The text was updated successfully, but these errors were encountered: