Uploading test results from pull requests (PRs) is a critical step for enabling Trunk Flaky Tests. This data provides a primary signal for detecting flaky tests and is the key metric for measuring their impact. Without it, you lose the most significant source of information for identifying and prioritizing these disruptive tests. Here’s a breakdown of the key features that depend on PR test results: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.
Crucial Flakiness Detection
The most common and critical signal for identifying a flaky test happens on PRs. Flakiness is detected when a test produces different results on the same git commit. This typically happens when:- A developer opens a PR, and a test fails.
- The developer reruns the exact same tests without changing any code.
- The test now passes.
Measuring Test Impact
The Flaky Tests dashboard is designed to help you prioritize which tests to fix first. The single most important metric for this isPRs Impacted. By default, the overview table is sorted by this metric because it’s the best way to measure a flaky test’s true impact on developer productivity.
If you don’t upload test results from PRs:
- The
PRs Impactedcount for every test will be zero. - You will have no way to determine which flaky tests are causing the most disruption.
- You lose the ability to prioritize fixes based on real-world data, potentially wasting time on less important issues.
Unblocking Developers with Quarantining
Quarantining is one of the most powerful features of Trunk Flaky Tests. Its core purpose is to prevent known flaky tests from blocking developers and breaking CI pipelines, especially merge queues. The entire quarantining workflow is predicated on analyzing test results from PRs. Without PR data, you cannot:- Identify tests as flaky from PR test runs: The system needs to see a test pass and fail on the same commit (a signal primarily gathered from PRs) to classify it as flaky.
- Apply Quarantine Logic at Runtime: Uploading a test result and checking if it should be quarantined are part of the same, single step in your CI job. When a test fails on a PR, the
Trunk Analytics CLIuploads the failure and, in the same operation, checks with the Trunk service to see if that test is on the quarantine list. If it is, the CLI overrides the job’s exit code, allowing the build to pass. Without running theTrunk Analytics CLIon your PR jobs, this real-time check cannot occur, and even known flaky tests will continue to block your PRs.
Immediate CI Feedback and Error Summaries
TheTrunk Analytics CLI provides a detailed summary directly in the CI job’s output log. This is the fastest, most immediate feedback a developer gets about their test run.
Without uploading PR results, you lose:
- A Clear Test Report Summary: A quick overview of
Total,Pass,Fail, andQuarantinedtests. - In-Log Failure Details: A snippet of the stack trace and assertion error for any failed test, providing immediate context without digging through full CI logs.
- Actionable Exit Codes: The CLI intelligently determines the job’s outcome.
- When a real test fails, it exits with a non-zero code:
⚠️ Some test failures were not quarantined, using exit code: 1 - When only a known flaky test fails, it passes the job:
🎉 All test failures were quarantined, overriding exit code to be exit_success (0)
- When a real test fails, it exits with a non-zero code: