From the course: JavaScript: Test-Driven Development (ES6)
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Checking test coverage with NYC - JavaScript Tutorial
From the course: JavaScript: Test-Driven Development (ES6)
Checking test coverage with NYC
A big concern of many software development teams who use TDD, is getting an accurate idea of how well their code base is covered by tests and where untested code might be hiding. And let's not fool ourselves it does happen quite often that untested code makes its way into the code base. Sometimes it's by accident, and sometimes it's intentional, usually due to laziness. So when this happens how do we figure out what parts of our code are going untested and fix it? Well, my recommendation is this there's a very handy tool called nyc which is an npm package you can install into your project. Let's do that now. npm install --save-dev nyc Now, what nyc does is it watches your code as your tests run and keeps track of what pieces of your production code were called during that time and which were not. And then it generates a report for you of your test coverage. So they way we actually use nyc is by doing this, let's open up…
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.