Hive Hive
Sign in

Generated test plans are deleted on consecutive tuist generate runs

GitHub issue · Open

Metadata
Source
tuist/tuist #12298
Updated
Aug 12, 2026
Domains
Generated projects Testing
Details

What happened?

A generated .xctestplan exists after the first tuist generate, but is deleted during the second consecutive generation.

Expected: repeated generation is idempotent and the generated test plan remains available.

How do we reproduce it?

  1. Use Tuist’s official examples/xcode/generated_app_with_generated_test_plan example.
  2. Run tuist generate.
  3. Confirm that Derived/TestPlans/*.xctestplan exists.
  4. Run tuist generate again without changing any files.
  5. Observe that the test plan is written and then Derived/TestPlans is deleted.

This reproduces without custom scripts or project helpers.

Error log

Side effect: create file Derived/TestPlans/GeneratedTestPlan.xctestplan
Side effect: delete directory Derived/TestPlans

macOS version

26.4.1

Tuist version

4.201.0

Xcode version

27.0 (27A5209h)

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] Aug 12, 2026

Hi @Kus-Sl! I’m Dosu and I’m helping the Tuist team.

This looks like a bug in DeleteDerivedDirectoryProjectMapper. On every tuist generate run, this mapper scans Derived/ and emits delete side effects for everything inside it — except directories listed in preservedDerivedDirectories, which only contains ModuleMaps and FrameworkSearchPaths [1]. The TestPlans subdirectory is not in that preserve list, so it gets scheduled for deletion.

Here’s what happens across two runs:

  1. First run: No Derived/ exists yet, so the mapper returns early with no side effects. The test plan side effect then creates Derived/TestPlans/GeneratedTestPlan.xctestplan.
  2. Second run: Derived/TestPlans/ now exists on disk. The mapper sees it isn’t preserved and emits .directory(state: .absent) [2]. Side effects execute sequentially [3], so the test plan file gets written first and then the directory delete runs, removing it.

The fix would be to add Constants.DerivedDirectory.testPlans ("TestPlans") to the preservedDerivedDirectories set [4] — the same way ModuleMaps and FrameworkSearchPaths are preserved today [5].

Since this is a bug with generated projects, you can try using the debug-generated-project skill with a coding agent like Claude, Codex, or OpenCode (following the steps in this repo) to validate and implement the fix against your local Tuist build. The example project at examples/xcode/generated_app_with_generated_test_plan already reproduces it reliably.

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

S
StefanBoblic Aug 15, 2026

I was able to reproduce the issue and traced it to DeleteDerivedDirectoryProjectMapper.

Derived/TestPlans was not included in the preserved derived directories, so generated test plans were scheduled for deletion on subsequent tuist generate runs.

I’ve opened a PR that preserves the TestPlans directory and adds regression coverage for this behavior.

PR: https://github.com/tuist/tuist/pull/12369