From the course: Angular: Workflows
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Enforcing code coverage - Angular Tutorial
From the course: Angular: Workflows
Enforcing code coverage
- [Instructor] We previously saw how we can generate code coverage reports. When trying to establish a test-driven culture within your teams it may be a good idea to enforce code coverage thresholds. There are mixed opinions on whether or not you should do this. Sure, a code with some 99% coverage may not necessarily mean that your code is bug-free. But tested code is one major step in the way of producing clean code. Enforcing coverage thresholds will promote testability among your team. 'Specially if your team is new to testing, and you can ensure that untested code is not making it's way to your code base. Head over to the karma.conf.js file, and then we'll configure the thresholds. Let's add a new property here. Thresholds. And let's configure first the global thresholds. For statements, branches, lines, and functions. 80 is an arbitrary percentage that I chose. But I think it is a good one to shoot for. You may also configure individual file thresholds using the exact same…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.