youtube image
From YouTube: Rethinking JavaScript Test Coverage - Benjamin Coe, Google

Description

In 2017 the V8 engine introduced built-in code coverage; the ability, during runtime, to track the executed lines, branches, functions, etc., of a program. This information is useful for: analyzing bottlenecks, finding unused code, and finding parts of a codebase that need more tests.

Realizing how valuable native coverage could be to the community, Ben made it a mission to expose this functionality in Node.js.

In JavaScript coverage had traditionally been facilitated by a clever hack; tools, like Istanbul, parse the code inserting no-op counters... While this parsing-based approach works, it has shortcomings: as the language evolves, parsers play catch up; counters decrease performance; counters sometimes break applications.

Implementing native coverage in Node.js, was an amazing opportunity for V8, Node.js, and the npm community to work together, and is an exciting success story.