JavaScript & TypeScript / Scenario

The 80% Gate and the Invisible File

A PR trips the branch-coverage threshold, a module is missing from the report entirely, and three teammates propose three different bad fixes.

Difficulty
Medium
Format
Scenario
Points
150
Estimate
12 min

// MISSION BRIEF

Your Mission

A routine PR to the checkout service fails CI on coverage. The author is confused: they added tests. The report shows one file with suspiciously split metrics, and a file everyone KNOWS exists is absent from the table.

Read the config, the report, and the Slack thread. Make the calls a senior would make: what the numbers mean, why the file is invisible, and which fixes are legitimate.

// FIRST CONTACT

Battle teaser

First artifact

jest.config.js (coverage section)

discounts.ts: 95.45% lines but 61.53% branches. What does that split typically mean?

  1. ANearly every line executes, but decision points (else arms, ternaries, || and ?? fallbacks, early returns) are exercised in only one direction, the error and edge paths are untested
  2. BBranch coverage always trails lines by ~30 points; the split is normal noise
  3. CThe file has syntax errors that break branch instrumentation
  4. DThe tests are asserting too much, which deflates the branch metric
Answers, scoring, hints, and the full battle stay sealed.

// SKILL TAGS

javascriptcoveragejestciquality-gates