When I upgraded my project from Expo45 to Expo48, I started encountering an error during testing:
TypeError: Cannot read properties of undefined (reading 'exists')
at exists (node_modules/expo-asset/src/PlatformUtils.ts:65:17)
at asyncGeneratorStep (node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
at _next (node_modules/@babel/runtime/helpers/asyncToGenerator.js:22:9)
The test itself is very simple:
it('Should render properly', () => {
render(
<UserContext.Provider
value={[initialState, jest.fn()]}
>
<UpdatePasswordScreen />
</UserContext.Provider>,
);
});
This is what the UpdatePasswordScreen component looks like:
<View style={styles.container}>
<Spinner
visible={showSpinner}
textContent={'Loading...'}
textStyle={{
color: '#FFFFFF',
}}
/>
<CustomInput
titleStyle={{
size: 13,
}}
titleContainerStyle={{
marginBottom: 10,
}}
containerStyle={{
marginBottom: 8,
}}
placeholder="Enter Password"
title="Old password"
value={oldPassword}
secureTextEntry={!showOldPassword}
onRenderLeftIcon={() => (
<Icon
name={showOldPassword ? 'eye' : 'eye-off'}
type="feather"
size={20}
color="#AFB4B9"
onPress={() => setShowOldPassword(!showOldPassword)}
/>
)}
onChangeText={setOldPassword}
/>
<View style={styles.confirmButton}>
<IconButton
text="Reset Password"
buttonStyle={{
height: 52,
width: 200,
}}
onPress={updatePassword}
disabled={!oldPassword || !newPassword
|| !confirmNewPassword || showPasswordErrorMessage()
|| newPassword !== confirmNewPassword
|| oldPasswordUnchanged
}
/>
</View>
</View>
I'm having trouble rendering the component even though the unit test ran successfully in Expo45. Any suggestions on how to fix this issue?
I appreciate any help!
Please advise on solving this problem.