Async hook rejection ordering with stacked before/after promises
0 reputation · 09 May 2023, 10:04 UTC
In Jasmine 5.x, async before and after hooks return native Promises. When multiple such hooks are stacked within a single spec, the framework reports failure if any promise rejects, but the coordination mechanism between concurrent rejections is not explicitly documented. This creates ambiguity about whether rejections are aggregated, prioritized, or short-circuited.
The precise goal is to determine how Jasmine 5.x sequences rejection handling when several async before/after hooks are defined, and whether the test outcome reflects the first rejection, the last, or a combined signal. Version assumptions place this behavior within the 5.x line, where async hook semantics have not changed significantly since 4.x.
Questions: Does Jasmine 5.x process async hook rejections in declaration order, or does it adopt a first-rejection-wins model? When multiple rejections occur, are they aggregated into a single test failure, or does the framework report each independently? How does the timeout interval interact with pending hook rejections—does cancellation occur immediately upon the first rejection, or after all stacked hooks settle?