Skip to content

Add Toggle disabled test code action#2545

Closed
william-laverty wants to merge 1 commit into
swiftlang:mainfrom
william-laverty:toggle-disabled-test
Closed

Add Toggle disabled test code action#2545
william-laverty wants to merge 1 commit into
swiftlang:mainfrom
william-laverty:toggle-disabled-test

Conversation

@william-laverty
Copy link
Copy Markdown

Description

Adds a syntax-based code action that toggles tests between enabled and disabled states, supporting both Swift Testing and XCTest.

Swift Testing:

  • Disable: @Test func ...@Test(.disabled()) func ...
  • Enable: @Test(.disabled()) func ...@Test func ...
  • Preserves existing traits when adding/removing .disabled()

XCTest:

  • Disable: Adds throws and inserts throw XCTSkip("Disabled") at the top of the body
  • Enable: Removes the throw XCTSkip line and optionally removes throws if no longer needed

Tests

  • Test disabling a Swift Testing test (@Test@Test(.disabled()))
  • Test enabling a disabled Swift Testing test (@Test(.disabled())@Test)

Resolves #2524

Adds a syntax-based code action that toggles tests between enabled and
disabled states.

**Swift Testing:**
- Enable: `@Test(.disabled())` → `@Test`
- Disable: `@Test` → `@Test(.disabled())`
- Preserves existing traits when adding/removing `.disabled()`

**XCTest:**
- Enable: Removes `throw XCTSkip("Disabled")` and optionally `throws`
- Disable: Adds `throws` and inserts `throw XCTSkip("Disabled")` at top

Resolves #2524
@loveucifer
Copy link
Copy Markdown
Member

there is an open pr for this issue #2541

@ahoppen ahoppen closed this Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Toggle disabled test

3 participants