Update to xunit.v3 (#20331)
* Update to xunit.v3 * Little more progress * More fixes * Keep VSTest supported * Adjust Nuke * Few fixes * Fix for xunit 2 * Fix GetData override * Adjust * Use MTP for xunit 2 * Fix test * Better fix * --no-progress * Few more fixes * no progress * Fix test * Better fix * TRX * Move to Directory.Build.props * Unify on MTP v2 * Update * Update to stable * 1.0.1 * 1.0.2 * Fix some warnings * Fix more warnings * Fix more warnings
This commit is contained in:
+12
-4
@@ -111,6 +111,9 @@ partial class Build : NukeBuild
|
||||
DotNetTestSettings ApplySetting(DotNetTestSettings c, Configure<DotNetTestSettings> configurator = null) =>
|
||||
ApplySettingCore(c).Test.Apply(configurator);
|
||||
|
||||
DotNetRunSettings ApplySetting(DotNetRunSettings c, Configure<DotNetRunSettings> configurator = null) =>
|
||||
ApplySettingCore(c).Run.Apply(configurator);
|
||||
|
||||
Target Clean => _ => _.Executes(() =>
|
||||
{
|
||||
foreach (var buildDir in Parameters.BuildDirs)
|
||||
@@ -182,7 +185,10 @@ partial class Build : NukeBuild
|
||||
{
|
||||
RunCoreTest(projectName, (project, tfm) =>
|
||||
{
|
||||
DotNetTest(c => ApplySetting(c, project,tfm));
|
||||
// NOTE: Nuke DotNetTest doesn't support Microsoft.Testing.Platform yet.
|
||||
// Issue: https://github.com/nuke-build/nuke/issues/1584.
|
||||
// However, we can easily use DotNetRun instead since MTP projects are executables.
|
||||
DotNetRun(c => ApplySetting(c, project, tfm));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -236,15 +242,17 @@ partial class Build : NukeBuild
|
||||
}
|
||||
}
|
||||
|
||||
DotNetTestSettings ApplySetting(DotNetTestSettings settings, string project, string tfm) =>
|
||||
DotNetRunSettings ApplySetting(DotNetRunSettings settings, string project, string tfm) =>
|
||||
ApplySetting(settings)
|
||||
.SetProjectFile(project)
|
||||
.SetFramework(tfm)
|
||||
.EnableNoBuild()
|
||||
.EnableNoRestore()
|
||||
// Disable progress output (works like terminal logger which isn't so nice in CI).
|
||||
// See https://github.com/microsoft/testfx/issues/7056
|
||||
.AddApplicationArguments("--no-progress")
|
||||
.When(_ => Parameters.PublishTestResults, _ => _
|
||||
.SetLoggers("trx")
|
||||
.SetResultsDirectory(Parameters.TestResultsRoot));
|
||||
.AddApplicationArguments("--report-trx", "--results-directory", Parameters.TestResultsRoot));
|
||||
|
||||
Target RunHtmlPreviewerTests => _ => _
|
||||
.OnlyWhenStatic(() => !(Parameters.SkipTests))
|
||||
|
||||
@@ -7,6 +7,7 @@ public class DotNetConfigHelper
|
||||
public DotNetBuildSettings Build;
|
||||
public DotNetPackSettings Pack;
|
||||
public DotNetTestSettings Test;
|
||||
public DotNetRunSettings Run;
|
||||
|
||||
public DotNetConfigHelper(DotNetBuildSettings s)
|
||||
{
|
||||
@@ -23,6 +24,11 @@ public class DotNetConfigHelper
|
||||
Test = s;
|
||||
}
|
||||
|
||||
public DotNetConfigHelper(DotNetRunSettings s)
|
||||
{
|
||||
Run = s;
|
||||
}
|
||||
|
||||
public DotNetConfigHelper AddProperty(string key, bool value) =>
|
||||
AddProperty(key, value.ToString(CultureInfo.InvariantCulture).ToLowerInvariant());
|
||||
public DotNetConfigHelper AddProperty(string key, string value)
|
||||
@@ -30,6 +36,7 @@ public class DotNetConfigHelper
|
||||
Build = Build?.AddProperty(key, value);
|
||||
Pack = Pack?.AddProperty(key, value);
|
||||
Test = Test?.AddProperty(key, value);
|
||||
Run = Run?.AddProperty(key, value);
|
||||
|
||||
return this;
|
||||
}
|
||||
@@ -39,6 +46,7 @@ public class DotNetConfigHelper
|
||||
Build = Build?.SetConfiguration(configuration);
|
||||
Pack = Pack?.SetConfiguration(configuration);
|
||||
Test = Test?.SetConfiguration(configuration);
|
||||
Run = Run?.SetConfiguration(configuration);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -47,10 +55,12 @@ public class DotNetConfigHelper
|
||||
Build = Build?.SetVerbosity(verbosity);
|
||||
Pack = Pack?.SetVerbosity(verbosity);
|
||||
Test = Test?.SetVerbosity(verbosity);
|
||||
Run = Run?.SetVerbosity(verbosity);
|
||||
return this;
|
||||
}
|
||||
|
||||
public static implicit operator DotNetConfigHelper(DotNetBuildSettings s) => new DotNetConfigHelper(s);
|
||||
public static implicit operator DotNetConfigHelper(DotNetPackSettings s) => new DotNetConfigHelper(s);
|
||||
public static implicit operator DotNetConfigHelper(DotNetTestSettings s) => new DotNetConfigHelper(s);
|
||||
public static implicit operator DotNetConfigHelper(DotNetRunSettings s) => new DotNetConfigHelper(s);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user