Similar to the question from here, I have upgraded to Expo 49 and now some of my Jest tests are failing with the following error:
TypeError: (0 , _auth(...).getReactNativePersistence) is not a function
For Jest tests, how do I make it so this error does not fail my tests?
The package.json includes the following relevant packages:
"firebase": "^10.4.0",
"expo": "~49.0.11",
With the following Firebase file:
import AsyncStorage from "@react-native-async-storage/async-storage";
import { initializeApp } from "firebase/app";
import { initializeAuth, getReactNativePersistence } from "firebase/auth";
import { getFirestore } from "firebase/firestore";
import { getStorage } from "firebase/storage";
// Your web app's Firebase configuration
const firebaseConfig = {...};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const auth = initializeAuth(app, {
persistence: getReactNativePersistence(AsyncStorage),
});
const db = getFirestore(app);
const storage = getStorage(app);
export { auth, db, storage };
2
Answers
Okay got it... Add the following in your setup file:
@Shawn were you able to figure out the getReactNativePersistence issue?