What is test coverage and how do you measure it?
Test coverage shows how much of your code is tested (lines, branches, functions).
Tools to measure:
- Istanbul/nyc: Most popular coverage tool.
- Jest: Has built-in coverage reports.
Run coverage with nyc:
nyc mocha
It outputs stats like:
- % of lines covered
- % of functions covered
- % of branches covered
Security in Node.js