I am losing my mind with the error. I am on react-native with jest (and no ts). I have a localization provider which exports several methods, including translations. translations is simply:
import LocalizedStrings from 'react-native-localization';
translations = new LocalStrings({en,de});
in my components, I do:
import { LocalizationContext } from './localization';
const { translations } = useContext(LocalizationContext);
now when running on my component, the whole import line is marked with about 6 E I E I
First, given I am only using translations, why are there more than one if and else to cover? and secondly, tranlations is set from LocalStrings of a third party library? should it even be tested?
I saw this question about jest config which advises about removing transform node from jest config but when i do it the whole test just stops with errors.
My jest config is:
{
"preset": "react-native",
"coverageReporters": [
"text",
"cobertura",
"lcov",
"json"
],
"moduleDirectories": [
"node_modules",
"src"
],
"transform": {
"^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
},
"transformIgnorePatterns": [
"node_modules/(?!((jest-)?react-native|@react-native-community/.*|react-navigation|react-navigation-drawer|@react-navigation/.*))"
]
}
My component simply outputs a provided value with no logic and there are no coverage notes at all except for the import.