Skip to content

Commit d4ae54f

Browse files
committed
fix: enhance cross-platform executable detection in external cancellation tests
1 parent c0a9330 commit d4ae54f

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

TUnit.Engine.Tests/ExternalCancellationTests.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ private async Task RunTestWithExternalCancellation(string filter, string markerF
3636
using var gracefulCancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(10));
3737
using var forcefulCancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(25));
3838

39-
var file = Path.Combine(testProject.DirectoryName!, "bin", "Release", GetEnvironmentVariable, "TUnit.TestProject.exe");
39+
// Use cross-platform executable detection (Linux: no extension, Windows: .exe)
40+
var binDir = new DirectoryInfo(Path.Combine(testProject.DirectoryName!, "bin", "Release", GetEnvironmentVariable));
41+
var file = binDir.GetFiles("TUnit.TestProject").FirstOrDefault()?.FullName
42+
?? binDir.GetFiles("TUnit.TestProject.exe").First().FullName;
4043

4144
var command = testMode switch
4245
{
@@ -51,7 +54,7 @@ private async Task RunTestWithExternalCancellation(string filter, string markerF
5154
.WithWorkingDirectory(testProject.DirectoryName!)
5255
.WithValidation(CommandResultValidation.None),
5356

54-
TestMode.Reflection => Cli.Wrap("dotnet")
57+
TestMode.Reflection => Cli.Wrap(file)
5558
.WithArguments(
5659
[
5760
"--treenode-filter", filter,

0 commit comments

Comments
 (0)