JetBrains / meta-runner-power-pack

A set of Meta-runners for TeamCity
Apache License 2.0
257 stars 125 forks source link

xUnit.net + dotCover meta-runner fails with mulitple exe's in xUnit NuGet package #136

Open MitchMcHenry1 opened 5 years ago

MitchMcHenry1 commented 5 years ago

If xUnit Console NuGet package contains multiple xunit.console.exe files, current code will include them all in the command line causing the xUnit execution to fail. For example, the standard xunit.runner.console.2.4.1 package contains exe's for net542, net46, net461, net462, etc.

May want to add a parameter for specific framework version or at least check for multiple results and just grab the first one (that's what I ended up doing).

Original code:

## get xunit runner from nuget package feed
Invoke-Expression "$nugetExe install xunit.runner.console -source $xUnitNuget"
$xunit = Join-Path $workingDir "xunit.runner.console.*\tools\$xUnitExe" | Resolve-Path

if (-not $xunit) {
    # Try finding xunit under framework specific folder
    $xunit = Join-Path $workingDir "xunit.runner.console.*\tools\net4*\$xUnitExe" | Resolve-Path
}

Workaround with check for multiple results (also include fix for space in path mentioned in #135:

## get xunit runner from nuget package feed
Invoke-Expression "& '$nugetExe' install xunit.runner.console -source $xUnitNuget"
$xunit = Join-Path $workingDir "xunit.runner.console.*\tools\$xUnitExe" -Resolve
if ($xunit.Length -gt 0) {$xunit = $xunit[0]}

if (-not $xunit) {
    # Try finding xunit under framework specific folder
    $xunit = Join-Path $workingDir "xunit.runner.console.*\tools\net4*\$xUnitExe" -Resolve
    if ($xunit.Length -gt 0) {$xunit = $xunit[0]}
}
muus84 commented 5 years ago

Thanks for the fix!