Hive Hive
Sign in

Scheme code coverage targets from external/SPM projects fail project linting

GitHub issue · Closed

Metadata
Source
tuist/tuist #11570
Updated
Jul 5, 2026
Domains
Generated projects
Details

What happened?

Xcode supports gathering code coverage for targets from anywhere in the workspace (Test action → “Gather coverage for some targets”), including Swift Package Manager packages.

Tuist, however, rejects these configurations during project linting:

  • Using a target name directly:

    The target ‘DesignSystem’ specified in Scheme code coverage targets list isn’t defined in the project.

  • Using an explicit TargetReference(projectPath:target:) pointing to another project:

    The target ‘DesignSystem’ specified in scheme ‘Scheme’ is not defined in the project named ‘X’. Consider using a workspace scheme instead to reference a target in another project.

As a result, tuist generate fails even though the configuration is perfectly valid in Xcode.

Expected behavior: codeCoverageTargets in a project scheme should be allowed to reference targets from other projects in the workspace (including SPM-generated projects), matching what Xcode already supports. Invalid references should still be caught by the workspace-level graph validation.

How do we reproduce it?

  1. Create a workspace with two projects (or one project plus an SPM dependency that generates its own project, e.g. DesignSystem).
  2. In a project scheme’s Test action, set codeCoverageTargets to a TargetReference(projectPath:target:) pointing at a target defined in another project.
  3. Run tuist generate.
  4. See the linting error.

Error log

The target 'DesignSystem' specified in scheme 'Scheme' is not defined in the project named 'X'. Consider using a workspace scheme instead to reference a target in another project.

macOS version

26.5.2 (25F84)

Tuist version

latest

Xcode version

26.6 (17F113)

Flights

Investigate, reproduce, or fix this item in an isolated repository. Each Flight preserves its outcome and agent session.

New Flights are paused Configure model inference, GitHub, and a sandbox provider to start another Flight. Existing results remain available below.
No Flights yet

Start a Flight and preserve its objective, outcome, and session here.

Comments
D
dosubot[bot] Jun 30, 2026

Hi @dogo! I’m Dosu and I’m helping the Tuist team.

There’s an open PR that directly addresses this issue: PR #11399 – Allow Scheme Code Coverage Targets from External Projects. It was last updated today (June 30, 2026) and makes two changes to the SchemeLinter [1]:

  1. lintCodeCoverageTargets now only validates targets belonging to the current project, deferring external references to the graph-level linter.
  2. projectSchemeCantReferenceRemoteTargets no longer treats codeCoverageTargets as cross-project dependency violations, since they’re coverage configuration rather than build dependencies.

This should let project schemes include code coverage targets from any project in the workspace (including SPM-generated ones) via an explicit TargetReference, which matches Xcode’s native behavior. You may want to track that PR for when it lands.

To reply, just mention @dosu.


Share context across your team and agents. Try Dosu.

Leave Feedback Learn about tuist with Dosu Add Dosu to your team