Skip to content

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:
        - ${ ref(Production Slack) }
        - ${ ref(Production Email) }

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 or ${ ref() }s to destinations that the alert notifies when it fires.