Failure notification dispatcher (FEA-001).
Dispatches notifications to configured channels when a test run completes with failures. Supports three channels:
- Microsoft Teams — Adaptive Card via incoming webhook.
- Email — HTML summary via the existing
emailSender.jstransport. - Generic webhook — POST JSON payload to a user-configured URL.
All dispatches are best-effort: errors are logged but never propagate to the caller, so a failing notification never affects the run outcome.
Usage
import { fireNotifications } from "../utils/notifications.js";
await fireNotifications(run, project);
- Source:
Methods
(static) fireNotifications(run, project) → {Promise.<void>}
Fire all configured notification channels for a completed run.
Only dispatches when:
- The run has failures (
run.failed > 0). - The project has notification settings configured and enabled.
All dispatches are best-effort — errors are logged but never thrown.
Parameters:
| Name | Type | Description |
|---|---|---|
run |
Object | The completed run object. |
project |
Object | The project |
- Source:
Returns:
- Type
- Promise.<void>
(inner) formatDuration(run) → {string}
Compute human-readable run duration.
Parameters:
| Name | Type | Description |
|---|---|---|
run |
Object |
- Source:
Returns:
- Type
- string
(inner) getAppUrl() → {string}
Build the base URL for deep links into the Sentri UI.
- Source:
Returns:
- Type
- string
(inner) getFailingTestNames(run) → {Array.<string>}
Extract failing test names from run results.
Parameters:
| Name | Type | Description |
|---|---|---|
run |
Object |
- Source:
Returns:
- Type
- Array.<string>
(inner) runDetailUrl(runId) → {string}
Build a deep link URL to a specific run detail page.
Parameters:
| Name | Type | Description |
|---|---|---|
runId |
string |
- Source:
Returns:
- Type
- string
(async, inner) sendEmailNotification(recipients, run, project) → {Promise.<void>}
Send a failure notification email to all configured recipients.
Parameters:
| Name | Type | Description |
|---|---|---|
recipients |
string | Comma-separated email addresses. |
run |
Object | Completed run object. |
project |
Object | Project object. |
- Source:
Returns:
- Type
- Promise.<void>
(async, inner) sendTeamsNotification(webhookUrl, run, project) → {Promise.<void>}
Send a Microsoft Teams Adaptive Card via incoming webhook.
Parameters:
| Name | Type | Description |
|---|---|---|
webhookUrl |
string | Teams incoming webhook URL. |
run |
Object | Completed run object. |
project |
Object | Project object. |
- Source:
Returns:
- Type
- Promise.<void>
(async, inner) sendWebhookNotification(url, run, project) → {Promise.<void>}
Send a generic webhook notification (POST JSON).
Parameters:
| Name | Type | Description |
|---|---|---|
url |
string | Webhook URL. |
run |
Object | Completed run object. |
project |
Object | Project object. |
- Source:
Returns:
- Type
- Promise.<void>