JavaScript & TypeScript / Scenario
The Suite That Passed While Production Burned
Three green tests, one broken alerting module, and a CI log full of unhandled rejections nobody read. Find the vacuous passes.
- Difficulty
- Medium
- Format
- Scenario
- Points
- 150
- Estimate
- 14 min
// MISSION BRIEF
Your Mission
The on-call engineer swears the alerting module is broken: no alerts fired during last night's incident. The test suite for that exact module is green. Both are right.
Read the test file and the CI log. Identify why each test passes without proving anything, and prescribe rewrites that make the assertions load-bearing.
// FIRST CONTACT
Battle teaser
First artifact
alerts.test.js (all three tests pass)
Test 1 is green while sendAlert is actually broken (the log shows its assertion exploding). Why does Jest report PASS?
- AtoBe(true) coerces undefined to true in older Node versions
- BThe promise chain is neither returned nor awaited, so the test function completes instantly; the assertion fails later inside a floating .then and surfaces only as an unhandled rejection warning
- CThe pager service mock is missing, which auto-passes the test
- DJest caches the previous green result when a test throws asynchronously
Answers, scoring, hints, and the full battle stay sealed.
// SKILL TAGS
javascriptasyncjestflakinesstest-quality