question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React native jest runtime

See original GitHub issue

Sorry about this, just an heads up on https://github.com/mswjs/node-request-interceptor/pull/37 This, while it correctly allow me to run msw on the application, it broke my tests. Apparently, while running my jest tests, the overrideModules.native.ts is also loaded, which is not the behaviour I was expecting.

I’ll look more into this tonight.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
kettanaitocommented, Aug 31, 2020

That should be fine. In RN development you should use msw/native, while in tests msw/node. I find that quite straightforward, even if they promise the same API.

With the latest version (0.5.0) that should work already, but I haven’t tested that yet.

1reaction
Federkuncommented, Aug 20, 2020

Hi kettanaito; sorry for the absence; yep I think it’s the way to go as well. It would have been nice to have the same setup/import for both jest and rn, but the user can likely get there using jest module aliases.

If there’s anything that worry me here is that both the node and the native package should expose the same api interface, as the user will use it interchangeably ( between jest and rn ) and expect the same behaviour. But it’s probably okay.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Testing React Native Apps - Jest
Run yarn test to run tests with Jest. ... If you are upgrading your react-native application and previously used the jest-react-native preset, ...
Read more >
Testing - React Native
This guide introduces React Native developers to the key concepts behind testing, how to write good tests, and what kinds of tests you...
Read more >
Testing Environments - React
Test runners like Jest, mocha, ava let you write test suites as regular JavaScript, and run them as part of your development process....
Read more >
Jest failed after upgrade to react-native 0.64 #703 - GitHub
Recently I upgraded my project to 0.64 version and faced this issue when I run jest. The same error happened even after I...
Read more >
jest-runtime examples - CodeSandbox
Learn how to use jest-runtime by viewing and forking example apps that make use of jest-runtime on CodeSandbox. ; projet3 ; responsive-react-app ;...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found