Closed vanGalilea closed 5 months ago
@vanGalilea You seem to be missing react-test-renderer
.
@mdjastrzebski thanks for your reaction, I've just added react-test-renderer
to my deps. yet no luck :/ the same error again
I've checked out your repo and see the error. Not sure what could have caused it, looks like some React misconfiguration.
I've updated our examples/basic
app to the latest expo with RN 73 to confirm it's not a general issues. It one works, so this is not some general RN 73 issue.
I've got the root cause. You are using a monorepo setup which results in both apps (expo and cli) installing different versions of react-native
package in the root node_modules
. This confuses the packager at the runtime, resulting in two different RN being loaded at the same time. If I update the CLI app version of RN to match Expo, then Expo tests start working.
To properly resolve this and avoid it in the future, you should probably use nohoist
setup for both apps.
@mdjastrzebski thanks for the deep dive and research, it all makes sense now! Thanks for taking the time and effort to have a look!
Describe the bug
__fbBatchedBridgeConfig is not set, cannot invoke native modules
error occurs when trying to render a simple RN component.Important to mention, that this is an expo app in a monorepo, this is the repo/commit. The test is dead simple and fails due to wrong configuration I think.
index.test.tsx
jest.config.js
Expected behavior
No errors when rendering a simple RN component.
Steps to Reproduce
Screenshots/ Full Error
Versions
Weirdly enough when running:
npx envinfo --npmPackages react,react-native,react-test-renderer,@testing-library/react-native
I only get:
So from
yarn.lock
: @testing-library/react-native => 12.4.3 jest => 29.7.0 jest-expo => 50.0.1 react => 18.2.0 react-native => 0.73.2