Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion TUnit.Engine/Framework/TUnitServiceProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,11 @@ public TUnitServiceProvider(IExtension extension,
}

// IdeStreamingSink: For IDE clients - real-time output streaming
if (VerbosityService.IsIdeClient)
// Disabled by default due to compatibility issues with Microsoft Testing Platform
// (duplicate TestNodeUid in TestApplicationResult.ConsumeAsync causes crashes in Rider/VS Code).
// Enable via TUNIT_ENABLE_IDE_STREAMING=1 environment variable.
if (VerbosityService.IsIdeClient &&
Environment.GetEnvironmentVariable("TUNIT_ENABLE_IDE_STREAMING") == "1")
{
TUnitLoggerFactory.AddSink(new IdeStreamingSink(MessageBus));
}
Expand Down
6 changes: 5 additions & 1 deletion docs/docs/customization-extensibility/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ TUnit automatically registers these sinks based on your execution context:
|------|-----------------|---------|
| **TestOutputSink** | Always | Captures output for test results shown after execution |
| **ConsoleOutputSink** | `--output Detailed` | Writes real-time output to the console |
| **RealTimeOutputSink** | IDE clients (VS, Rider) | Streams output to IDE test explorers |
| **RealTimeOutputSink** | IDE clients + `TUNIT_ENABLE_IDE_STREAMING=1` | Streams output to IDE test explorers |

:::note
The RealTimeOutputSink (IDE streaming) is disabled by default due to compatibility issues with the Microsoft Testing Platform that can cause crashes in some IDEs. Set the `TUNIT_ENABLE_IDE_STREAMING=1` environment variable to opt in. See [Environment Variables](/docs/reference/environment-variables) for details.
:::

### Creating Custom Log Sinks

Expand Down
22 changes: 22 additions & 0 deletions docs/docs/reference/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,27 @@ export TUNIT_MAX_PARALLEL_TESTS=0 # Unlimited parallelism

**Note:** Command-line arguments take precedence over environment variables.

### TUNIT_ENABLE_IDE_STREAMING

Enables real-time output streaming to IDE test explorers (Rider, VS Code, Visual Studio).

```bash
# Bash/Linux/macOS
export TUNIT_ENABLE_IDE_STREAMING=1

# PowerShell
$env:TUNIT_ENABLE_IDE_STREAMING = "1"

# Windows Command Prompt
set TUNIT_ENABLE_IDE_STREAMING=1
```

**Default:** Disabled

**Use case:** When running tests in an IDE, this enables real-time streaming of test output (e.g. `Console.WriteLine`) to the test explorer while tests are still running. Without this, output is shown after each test completes.

**Note:** This feature is disabled by default due to known compatibility issues with the Microsoft Testing Platform that can cause test runner crashes in some IDEs. Enable it only if you want real-time output streaming and are not experiencing issues.

## Microsoft Testing Platform Environment Variables

These environment variables are provided by the underlying Microsoft Testing Platform:
Expand Down Expand Up @@ -196,3 +217,4 @@ When the same setting is configured in multiple places, TUnit follows this prior
| `TUNIT_ENABLE_JUNIT_REPORTER` | - | Enables JUnit reporter |
| `JUNIT_XML_OUTPUT_PATH` | - | JUnit output path |
| `TUNIT_MAX_PARALLEL_TESTS` | `--maximum-parallel-tests` | Max parallel tests |
| `TUNIT_ENABLE_IDE_STREAMING` | - | Enable real-time IDE output streaming |
Loading