Jest tests: 'return' outside of function
See original GitHub issueGoals
When i run jest test component should not have errors.
Expected Results
No errors
Actual Results
28 | if ('REALM_DISABLE_ANALYTICS' in process.env) {
29 | module.exports = function(){};
> 30 | return;
| ^
31 | }
32 |
33 | const os = require('os');
Steps to Reproduce
Code Sample
Version of Realm and Tooling
- Realm JS SDK Version: latest
- Node or React Native: latest
- Client OS & Version: latest
- Which debugger for React Native: ?/None
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:14 (3 by maintainers)
Top Results From Across the Web
Mock Functions - Jest
Mock functions allow you to test the links between code by erasing the actual implementation of a function, capturing calls to the function ......
Read more >When running a Jest test, a variable outside the function is ...
After running the test, there is an error. ReferenceError: proxy is not defined. I have solved this error by mocking the module below...
Read more >Testing JavaScript with Jest - Flavio Copes
Jest is a library for testing JavaScript code. It's an open source project ... With functions that return promises, we return a promise...
Read more >How to use Jest spyOn with React.js and Fetch - Meticulous
Good testing involves mocking out dependencies. Jest provides multiple ways to mock out dependencies while writing unit tests. The most common ...
Read more >Globals · Jest
Runs a function after all the tests in this file have completed. If the function returns a promise, Jest waits for that promise...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@bang88 try to modify your package.json: “jest”: { “preset”: “react-native”, “transformIgnorePatterns”: [ “node_modules/(realm)/” ] }
it helps me
I was able to resolve the issue with the following in
.babelrc: