Why can’t a Project scheme’s testAction reference test targets from another project?

Question or problem

In a multi-project Tuist workspace, why can’t a Project scheme’s testAction reference unit-test targets that live in another project via TargetReference.project(path:target:), while the same cross-project testables can be added in Xcode’s scheme editor UI after generation?

We’re trying to understand the design rationale for this restriction (not looking for a workaround recipe).

Current behavior

tuist generate fails with:

The target CoreKit-UnitTests specified in scheme MyApp is not defined in the project named App. Consider using a workspace scheme instead to reference a target in another project.

That message comes from SchemeLinter.swift L173 (projectSchemeCantReferenceRemoteTargets).

Meanwhile, after generating without that cross-project reference, opening the App scheme in Xcode UI and adding CoreKit-UnitTests to the Test action works at runtime.

The generated Tuist workspace scheme is not a good fit for us either: it also includes UI test targets that exist in the project, which we don’t want in this aggregated test action.

Expectation

Project schemes should be able to include cross-project test targets the same way Xcode’s scheme editor allows — or, if this is intentional, understanding why project schemes are restricted while Xcode GUI / runtime still allow it.

Context

  • Tuist version: 4.203.4
  • Workspace layout (simplified):
    • App project (app + its own unit/snapshot tests + UI tests)
    • Frameworks/CoreKit project (framework + unit tests)
    • shared Workspace.swift including both projects

We want the App scheme’s Test action to also run dependency module tests (convenient for local/CI workflows), without hand-editing generated schemes.

Sample

Declare a scheme on the App Project that references another project’s tests:

// inside Project.swift for App
Scheme.scheme(
  name: "MyApp",
  testAction: .targets([
    .testableTarget(target: .target("MyApp-UnitTests")),
    .testableTarget(target: .project(
      path: "Frameworks/CoreKit",
      target: "CoreKit-UnitTests"
    ))
  ])
)