Measure Code Coverage

We didn’t write any code without writing failing tests first. Hence, the coverage should hold no surprises. Let’s take a couple of minutes to view the code in the online resources on the website for this book. We wrote the following tests:

  • code/testexpress/todo/test/server/db-test.js
  • code/testexpress/todo/test/server/models/task-test.js
  • code/testexpress/todo/test/server/common/validate-task-test.js
  • code/testexpress/todo/test/server/routes/tasks-test.js

With the help of these tests, we designed the functions in the following files:

  • code/testexpress/todo/db.js
  • code/testexpress/todo/models/task.js
  • code/testexpress/todo/public/javascripts/common/validate-task.js
  • code/testexpress/todo/routes/tasks.js

Let’s measure the code coverage ...

Get Test-Driving JavaScript Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.