Reputation: 24234
I'm using create-react-app which uses Jest for testing.
I have index.js
files containing exports lines like
export { default } from './App.component';
which decreases the test coverage of my application.
Q: How to test such files or at least ignore them?
Upvotes: 3
Views: 1962
Reputation: 339
You can ignore these files using a collectCoverageFrom
config in your jest configuration.
{
"jest": {
collectCoverageFrom: [
'<yourDirectoryStructure>/**/*.{js,jsx}',
'!<yourDirectoryStructure>/**/index.{js,jsx}',
]
}
}
Upvotes: 4