joltup / rn-fetch-blob

A project committed to making file access and data transfer easier, efficient for React Native developers.
MIT License
2.81k stars 771 forks source link

TypeError: Cannot read properties of undefined (reading 'DocumentDir') #765

Open MohammedTAgha opened 2 years ago

MohammedTAgha commented 2 years ago

I have just installed this library but when I am importing it into my project I have an error **

TypeError: Cannot read properties of undefined (reading 'DocumentDir') at node_modules\expo\build\logs\LogSerialization.js:156:14 in _captureConsoleStackTrace at node_modules\expo\build\logs\LogSerialization.js:41:26 in serializeLogDataAsync

Francesco-Voto commented 2 years ago

As workaround for the moment you can try something like

jest.mock('rn-fetch-blob', () => ({
  fs: {
    dirs: {
      CacheDir: './',
    },
    unlink: jest.fn(),
  },
  config: () => ({
    fetch: jest.fn(),
  }),
}));