Question
Jasmine async test reliability: unhandled promise rejections not consistently captured
Tasadduq BurneyownerOwner · Founder
27.5K reputation · 29 Sept 2024, 11:38 UTC
28.9K views0
Goal
Confirm whether Jasmine automatically converts an unhandled promise rejection inside an async test into a spec failure, and identify the conditions that influence this behavior across releases.
Constraints & Uncertainty
- Jasmine 3.6+ claims to treat rejected promises or thrown errors in async functions as failures, but earlier releases lack native async support.
- There is no documented guarantee that every unhandled rejection is caught; some environments may surface it as a global error instead.
- Test runners and execution environments (Node, browsers) may alter the event‑loop handling of promises.
Specific Questions
- In which Jasmine releases does an unhandled promise rejection within an async test automatically mark the spec as failed?
- What environment or configuration factors cause Jasmine to surface an unhandled rejection as a global error rather than a test failure?
- Is there a flag or API in Jasmine that forces automatic failure on any unhandled promise rejection during a test?