Heads up! To view this whole video, sign in with your Courses Plus account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Code Coverage with Istanbul!
You have completed Code Coverage with Istanbul!
Preview
In this video we'll look what code coverage is, why you should use it and what it _doesn't_ do.
Resources
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
[MUSIC]
0:00
Hello world.
0:04
Andrew here, JavaScript developer,
lifelong learner and
0:05
teacher here at Treehouse.
0:08
In this workshop, we're going to
be talking about code coverage.
0:10
Code coverage is the healthy
development practice that describes how
0:14
much of a program source code is executed
during the execution of the test sweep.
0:18
So, why should you do code coverage?
0:23
Well, it helps to see how much
testing you're doing in your project.
0:26
It helps you spot parts in your
code that the tests are missing.
0:29
It's also good to show business
stakeholders in a project,
0:33
whether they are a project manager or
clients on a project.
0:36
If you're publishing NPM modules,
0:40
showing your code coverage gives
developers confidence in your module.
0:43
For example, you'd expect
a module with 100% code coverage
0:47
should work better than
a module with only 10%.
0:51
While software with more code coverage
may instill more confidence than software
0:54
without code coverage,
0:58
it doesn't guarantee the quality of
the tests that test the source code.
1:00
For example,
there may be sets in edge cases missing.
1:04
Because test edge cases could be missing,
1:08
there could be some bugs
that could still happen.
1:10
In other words, having 100% code
coverage doesn't ensure good software.
1:14
The till we'll be using for
code coverage is called Istanbul.
1:20
Istanbul is a node module that's
compatible with testing libraries
1:24
like Mocha and Jasmine.
1:27
Istanbul can generate code coverage
reports that are compatible with
1:29
online services like Coveralls and
Codecov.
1:32
You can share your open source
projects code coverage publicly, or
1:37
your internal or
client projects privately.
1:40
In this workshop, we're going to set up
code coverage in a simple calculator app.
1:44
Feel free to clone the app now or download
the zip file attached to this video.
1:48
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up