Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

Support react-test-renderer #249

Open
SimenB opened this issue Dec 7, 2016 · 3 comments
Open

Support react-test-renderer #249

SimenB opened this issue Dec 7, 2016 · 3 comments

Comments

@SimenB
Copy link

SimenB commented Dec 7, 2016

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 enzymejs/enzyme#715 I suppose

@developit
Copy link
Member

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.

@jackyef
Copy link

jackyef commented Apr 12, 2020

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.

@marvinhagemeister
Copy link
Member

@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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants