<!--
{
  "availability" : [
    "Swift: 6.2.0 -",
    "Xcode: 26.0.0 -",
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "swift: 6.0.0 -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Testing",
  "identifier" : "/documentation/Testing/Trait/filterIssues(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Swift Testing",
      "Testing"
    ],
    "preciseIdentifier" : "s:7Testing5TraitPA2A013IssueHandlingB0VRszrlE12filterIssuesyAESbAA0C0VYbcFZ"
  },
  "title" : "filterIssues(_:)"
}
-->

# filterIssues(_:)

Constructs a trait that filters issues recorded by a test.

```
static func filterIssues(_ isIncluded: @escaping @Sendable (Issue) -> Bool) -> Self
```

## Parameters

`isIncluded`

The predicate with which to filter issues recorded by the
test this trait is applied to. It is passed a recorded issue, and
should return `true` if the issue should be included, or `false` if it
should be suppressed.

## Return Value

An instance of [`IssueHandlingTrait`](/documentation/Testing/IssueHandlingTrait) that filters issues.

## Discussion

The `isIncluded` closure is called synchronously each time an issue is
recorded by the test this trait is applied to. The closure is passed the
recorded issue, and if it returns `true`, the issue will be preserved in
the test results. Otherwise, if the closure returns `false`, the issue
will not be included in the test results.

The `isIncluded` closure may be called more than once if the test records
multiple issues. If more than one instance of this trait is applied to a
test (including via inheritance from a containing suite), the `isIncluded`
closure for each instance will be called in right-to-left, innermost-to-
outermost order, unless `false` is returned, which will skip invoking the
remaining traits’ closures.

Within `isIncluded`, you may access the current test or test case (if any)
using [`current`](/documentation/Testing/Test/current) [`current`](/documentation/Testing/Test/Case/current), respectively. You may also
record new issues, although they will only be handled by issue handling
traits which precede this trait or were inherited from a containing suite.

> Note: `isIncluded` will never be passed an issue for which the value of
> ``doc://org.swift.testing/documentation/Testing/Issue/kind-swift.property`` is ``doc://org.swift.testing/documentation/Testing/Issue/Kind-swift.enum/system``.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)