Alert
Alerts fire when their if expression evaluates to true after a visivo
test run. They forward the result to one or more destinations (Slack,
email, console).
The if expression is a >{ ... } eval string. The anyTestFailed()
helper returns true when at least one test in the run failed, and
env.VARIABLE_NAME exposes environment variables so you can scope
alerts to specific environments.
Example
alerts:
- name: Example Alert
if: '>{ anyTestFailed() && env.ENVIRONMENT == "PRODUCTION" }'
destinations:
- name: Production Slack
type: slack
webhook_url: ${env.SLACK_WEBHOOK}
- name: Production Email
type: email
to: data-team@your_company.com
host: your_company_email_server.com
username: alerts
password: ${env.EMAIL_PASSWORD}
Attributes
| Field | Type | Default | Description |
|---|---|---|---|
| path | string | None | A unique path to this object |
| name | string | None | The unique name of the object across the entire project. |
| file_path | string | None | The path to the file that contains the object definition. |
| if_ | string | None | An eval string (>{ ... }) that must evaluate to true for the alert to fire. |
| destinations | Array of ConsoleDestination or EmailDestination or SlackDestination | [] | Destination objects, defined inline on the alert, that it notifies when it fires. Only concrete destinations are accepted here: a reference to a top-level destinations: entry is not resolved on this field. |