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.

Have to keep re-installing, plus jest warnings

See original GitHub issue

Occasionally (I haven’t tied down the exact circumstances yet) I get compilation errors suggesting this module is not installed, so I have to install it again. It is registered like this in package.json, because I need v3: "react-native-document-picker": "git://github.com/Elyx0/react-native-document-picker.git#v3", (I’ve followed the instructions documented in https://github.com/Elyx0/react-native-document-picker/issues/94)

Also, in running jest tests I’m seeing this warning, I’m not sure if it’s the same problem as above or different: RNDocumentPicker Native module is not available, make sure you have finished the installation process and rebuilt your app

Also, running jest with --detectOpenHandles is showing this:

Jest has detected the following 1 open handle potentially keeping Jest from exiting:
  ●  TIMERWRAP
      at Object.<anonymous> (node_modules/react-native-document-picker/index.js:7:3)

Issue Analytics

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

github_iconTop GitHub Comments

4reactions
gnpricecommented, Aug 8, 2019

In case it helps someone else: I worked around this issue by not import-ing the library, and instead require-ing it just before the code that will actually invoke it. Like this:

    const DocumentPicker = require('react-native-document-picker').default;
    /* ... */ await DocumentPicker.pick( // ...

It’d still be good for that to not be necessary.

3reactions
thomazcapracommented, Mar 31, 2021

Adding this mock in the jest.setup.js file fixed the warning for me.

jest.mock('react-native-document-picker', () => ({ default: jest.fn(), }));

Read more comments on GitHub >

github_iconTop Results From Across the Web

What do these npm warnings mean when installing Jest in ...
npm WARN burtrandpaulie No README data npm WARN burtrandpaulie No license field. which just says your package.json doesn't have that info.
Read more >
Disable Jest Warnings - Today I Learned - TIL @ Hashrocket
Disable Jest Warnings. Jest has a --silent flag that will omit warnings but keep errors: yarn test --silent.
Read more >
Avoiding React act warning when accessibility testing next/link ...
First, the act() warning typically doesn't cause Jest tests to fail. It's just a warning. But it, along with other warnings (such as...
Read more >
React app testing: Jest and React Testing Library
Learn how to test React applications with Jest and React Testing Library, a popular combination and official recommendation from React.
Read more >
How to Test Your Apps using Jest, Testing Library, Cypress ...
Hi everyone! In this article we're going to talk about testing. I'll give you a good overview of what testing is and an...
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