Ad
Coverage In Jest And Enzyme In React Aplication
I have a React application and I added tests with jest and enzyme. I make a unit test for a react component called <Duration.jsx />
.
And the coverage shows me all components coverage inside <Duration.jsx />
and files.scss. Is it normal?
Ad
Answer
I think this depends on how you write your tests. IMHO, the coverage is a by-product of tests. For example, if you use enzyme
and shallow(<LayoutMessage />)
, then you are not going to render the children of LayoutMessage
.
If you render normally using render(<LayoutMessage />)
then you will also render the children of LayoutMessage
, increasing the lines that your tests execute.
Ad
source: stackoverflow.com
Related Questions
- → Import statement and Babel
- → should I choose reactjs+f7 or f7+vue.js?
- → Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined
- → .tsx webpack compile fails: Unexpected token <
- → React-router: Passing props to children
- → ListView.DataSource looping data for React Native
- → React Native with visual studio 2015 IDE
- → Can't test submit handler in React component
- → React + Flux - How to avoid global variable
- → Webpack, React & Babel, not rendering DOM
- → How do I determine if a new ReactJS session and/or Browser session has started?
- → Alt @decorators in React-Native
- → How to dynamically add class to parent div of focused input field?
Ad