Closed jayshah123 closed 4 years ago
This will be generally solved by https://github.com/mobxjs/mobx-react/pull/787 once I get to finishing it up :)
For now, you basically have to force mobx-react
in Jest config to resolve to RN bundle instead of regular CJS one.
Hm, that might not actually work because RN bundle uses ESM which Jest cannot handle afaik. Cannot think of any viable workaround for now so I guess it makes #787 fairly important now :)
@jayshah123 this PR makes the test run https://github.com/jayshah123/mobx-jest-test-error/pull/1 . I didn't go any further than that though, so not sure if some more complicated tests relying on mobx will work too.)
Please, upgrade to mobx-react 6.2.0 and see instructions in the readme.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or questions.
Having a fairly barebones react-native + mobx setup here (https://github.com/jayshah123/mobx-jest-test-error) Running
npm test
asks forreact-dom
dependency.Intended outcome
Jest test should run as expected
Actual outcome
Test fails saying:
Cannot find module 'react-dom' from 'mobxreact.cjs.development.js'
Full error:
How to reproduce the issue
https://github.com/jayshah123/mobx-jest-test-error
Versions