I'm sorry if this is a rather ambiguous question -- I used to be one of those devs who is far too lazy to write unit tests, but now that I'm working on a pretty large project, I've come to see the value in them.
I've set up istanbul with some (hopefully) sensible thresholds:
const options = {
codeCoverage: {
reporters: ['lcov', 'text-summary'],
thresholds: {
global: { statements: 80, branches: 80, functions: 80, lines: 80 },
each: { statements: 50, branches: 50, functions: 50, lines: 50 }
}
}
};
But this causes my test task in gulp
to fail, because istanbul reports that my config files (those that set up middleware and various other boilerplate-ish stuff) aren't covered.
I've tried searching for hours, but haven't found any guidelines as to which code is safe to ignore -- I've only been told by more senior developers that it's necessary to test controllers and so on, but not config files -- which are pretty much impossible to test anyway. Feedback would be much appreciated!
Aucun commentaire:
Enregistrer un commentaire