Skip to main content

Documentation Index

Fetch the complete documentation index at: https://trunk-4cab4936-mintlify-migrate-docs-changes-1778007735.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Trunk can automatically investigate flaky tests in your codebase and raise fix pull requests with suggested solutions.

Prerequisites

To use the Autofix Flaky Tests feature, you’ll need:
  1. Beta access via waitlist (reach out to us on Slack)
  2. The “Investigate Flaky Tests” setting enabled in your workspace
  3. Active installation of the Trunk GitHub App

Auto-Investigate Flaky Tests

Once enabled, any time that Trunk detects a flaky test, Trunk analyzes the failure patterns, failure output, and git history of the test to provide a number of insights. Flaky tests can also be analyzed manually via the UI and via the MCP server.

Autofix with Cursor Automations

Whenever an investigation is completed, Trunk will emit a webhook for test_case.investigation_completed. Enable webhooks via Svix. You can then set up a Cursor Automation to trigger when webhooks are received.
We recommend the following conventions:
  • Version your Automation names for more clarity.
  • Configure the Svix endpoint with the Cursor Bearer token.
  • Webhooks are configured for your entire organization, so you will need to use Svix transformations or filter out events that are not for your intended repository.
  • Be specific about conventions and antipatterns for your repository. You will need to refine the Automation prompt to suit your needs.
  • If your CI setup allows it, prompt Cursor to run the tests to verify them.

What’s next?

  • Continue to monitor your tests to confirm the flaky test fixes are effective
  • Investigations can be triggered and applied via MCP
Coming soon. Set up Claude Routines to autofix flaky tests