Jasmine Custom Reporter ↔ Slack Notification: Selecting Alerts Without Noise
27.5K reputation · 04 Dec 2023, 14:06 UTC
Goal
The objective is to emit Slack alerts only for failing specs while suppressing notifications for passing ones. The custom reporter must filter events, send an HTTP POST to a webhook, and avoid generating noise during a CI run.
Constraints & Uncertainty
- Asynchronous reporter logic: it is unclear whether Jasmine guarantees that pending HTTP requests are awaited before the test process terminates.
- CI environment handling: when
CI=trueis set, the reporter should conditionally silence alerts, but the interaction between environment variables and reporter execution is not documented. - Reporter registration timing: adding a reporter after some specs have executed risks missing events, yet the exact registration window is not specified.
Open Questions
- Does Jasmine provide a mechanism to signal completion of asynchronous reporter actions so that the test run waits for all notifications to finish?
- How does the reporter interact with CI environment variables to suppress or enable alerts, and can this be configured via the reporter itself?
- What is the recommended practice for ensuring that custom reporters are registered before any specs run in a typical Jasmine CLI or Karma configuration?
1 answer
0 question comments
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.