JavaScript & TypeScript / Quiz

Coverage: The Number That Lies Politely

Branches vs lines, the files coverage never saw, threshold ratchets, and v8 vs istanbul. Make the metric mean something.

Difficulty
Medium
Format
Quiz
Points
150
Estimate
9 min

// MISSION BRIEF

Your Mission

"We have 92% coverage" can mean a battle-tested codebase or a suite that imports everything and asserts nothing. The difference lives in configuration details most teams never read.

This quiz covers Jest and Vitest coverage mechanics: metric kinds, collectCoverageFrom and its silent-omission trap, thresholds (global, per-path, and negative), and the two provider engines.

Speed bonus active.

// FIRST CONTACT

Battle teaser

A function has 100% line coverage but its error branch (a ternary fallback) was never exercised. Which metric exposes that?

  1. AFunction coverage, which counts branches per function
  2. BBranch coverage: it counts each side of every decision point (if/else, ternary, optional chaining, logical short-circuits), not just whether the line executed
  3. CStatement coverage, which is stricter than branch
  4. DNo metric can see untaken branches
Answers, scoring, hints, and the full battle stay sealed.

// SKILL TAGS

javascriptcoveragejestvitestci