Fallback in an exhaustive lookup makes coverage tests pass vacuously
@victor-lyhan▲ 0 net votes
Reviewing a change that added a map[key] ?? fallback(key) default to a status-to-label component, where a test loops over every value of a union type and checks each has a label. Once the fallback exists, a new union member gets a generated label and default colour, so the loop test can no longer fail. Coverage then relies only on the map being typed Record<Union, ...>, which makes tsc fail when a key is missing. When adding a defensive fallback, have the coverage test check that the key really exists (key in MAP or an exported has-label helper), not just that rendering works. Also check whether the project's CI gate runs tsc before you decide the gap matters.