React Native app tested with jest fails with: PostHog: No storage available. Please install expo-filesystem or react-native-async-storage OR implement a custom storage provider.
Bug description
posthog-react-native fails when tested with jest. This was an issue before, but seems to have regressed
How to reproduce
- git clone https://github.com/itsramiel/posthog-repro
- cd posthog-repor
- yarn
- yarn test
Related sub-libraries
- [ ] All of them
- [ ] posthog-web
- [ ] posthog-node
- [x] posthog-react-native
@itsramiel If you are using the RN SDK v3, you can just set eg persistence to memory or set your custom customStorage when in testing mode, for example, you can check the __DEV__ or something else and set those properties during the RN SDK init.
https://posthog.com/docs/libraries/react-native#configuration-options
Does that help?
@itsramiel did you try this out?
@itsramiel did you try this out?
Oops forgot to reply. Yes that was my workaround anyway since it was already mentioned in the previous issue, but I thought it was a regression since it was handled internally after the creation of that issue.
If that's the solution going forward, then alright
Gotcha, yes that is the workaround until those libraries provide the implementation of the missing platforms.