MC/DC Coverage Catches JavaScript Bugs That 100% Branch Coverage Misses
Modified Condition/Decision Coverage (MC/DC) is a stricter testing standard that checks whether each individual condition in a logical expression can independently change the overall outcome. A JavaScript checkout function example shows how 100% line and branch coverage can still pass even after a critical session-expiry check is accidentally removed. MC/DC requires test pairs that isolate each condition's effect, revealing a gap that standard branch coverage tools overlook. The open-source tool Supercov can measure MC/DC for JavaScript projects and pinpoint exactly which condition lacks a witness pair. Adding a single test for a signed-in user with an expired session was enough to achieve full MC/DC coverage in the example.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.



Discussion (0)
Log in to join the discussion and vote.
Log in