preact-compat
preact-compat copied to clipboard
Support react-test-renderer
It's amazing in Jest tests. But I get
Cannot find module 'react/lib/ReactComponentTreeHook' from 'ReactDebugTool.js'
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:151:17)
at Object.<anonymous> (node_modules/react-test-renderer/lib/ReactDebugTool.js:16:30)
at Object.<anonymous> (node_modules/react-test-renderer/lib/ReactInstrumentation.js:19:24)
With the following config:
"moduleNameMapper": {
"^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/FileStub.js",
"^.+\\.css$": "identity-obj-proxy",
"fbjs/lib/invariant": "invariant",
"fbjs/lib/warning": "warning",
"react": "preact-compat",
"react-dom": "preact-compat"
},
https://github.com/facebook/react/blob/master/src/isomorphic/hooks/ReactComponentTreeHook.js
Kinda related to airbnb/enzyme#715 I suppose
Hi Simen! Definitely want to support this outcome, though I think it's likely to be a module that gets directly aliased (preact-test-renderer
), since the internals behind that facade a little vast.
Hi, sorry to bring up this old issue. I was wondering if there has been any solution to this now?
I found this workaround, but still unsure whether that it is the recommended way.
@jackyef We don't have an official json renderer right now. In either way we won't add new features to preact-compat
which is based on an older version of Preact (8.x). preact-compat
was moved to core and is available under preact/compat
.
Let's move the discussion over to the main Preact repo