Skip to content

Commit 8656ced

Browse files
authored
Merge pull request #30 from nunit/issue-29
Updates to zipPackage, NUnitLiteRunner
2 parents cd5348b + 94f01b5 commit 8656ced

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

recipe/package-definition.cake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ public abstract class PackageDefinition
275275
throw new Exception("One or more package tests had errors!");
276276
}
277277

278-
private void InstallExtensions(ExtensionSpecifier[] extensionsNeeded)
278+
protected virtual void InstallExtensions(ExtensionSpecifier[] extensionsNeeded)
279279
{
280280
foreach (ExtensionSpecifier extension in extensionsNeeded)
281281
extension.InstallExtension(this);

recipe/test-runners.cake

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,17 @@ public class TestRunnerSource
143143
// For NUnitLite tests, the test is run directly
144144
public class NUnitLiteRunner : TestRunner, IUnitTestRunner
145145
{
146-
public int RunUnitTest(FilePath testPath) =>
147-
RunTest(testPath, BuildSettings.UnitTestArguments);
146+
public int RunUnitTest(FilePath testPath)
147+
{
148+
var processSettings = new ProcessSettings { Arguments = BuildSettings.UnitTestArguments };
149+
if (CommandLineOptions.TraceLevel.Exists)
150+
processSettings.EnvironmentVariables = new Dictionary<string, string>
151+
{
152+
{ "NUNIT_INTERNAL_TRACE_LEVEL", CommandLineOptions.TraceLevel.Value }
153+
};
154+
155+
return RunTest(testPath, processSettings);
156+
}
148157
}
149158

150159
/////////////////////////////////////////////////////////////////////////////

recipe/zip-package.cake

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public class ZipPackage : PackageDefinition
2222

2323
// ZIP package supports bundling of extensions
2424
public PackageReference[] BundledExtensions { get; }
25+
public bool HasBundledExtensions => BundledExtensions != null;
2526

2627
// The file name of this package, including extension
2728
public override string PackageFileName => $"{PackageId}-{PackageVersion}.zip";
@@ -46,6 +47,12 @@ public class ZipPackage : PackageDefinition
4647
_context.Unzip($"{BuildSettings.PackageDirectory}{PackageFileName}", $"{PackageInstallDirectory}{PackageId}.{PackageVersion}");
4748
}
4849

50+
protected override void InstallExtensions(ExtensionSpecifier[] extensionsNeeded)
51+
{
52+
// TODO: Do nothing for now. Future: only install extensions not bundled
53+
// or previously installed.
54+
}
55+
4956
private void CreateZipImage()
5057
{
5158
_context.CleanDirectory(BuildSettings.ZipImageDirectory);
@@ -58,10 +65,6 @@ public class ZipPackage : PackageDefinition
5865
BuildSettings.OutputDirectory,
5966
BuildSettings.ZipImageDirectory + "bin/" );
6067

61-
_context.CopyFileToDirectory(
62-
BuildSettings.ZipDirectory + "nunit.bundle.addins",
63-
BuildSettings.ZipImageDirectory);
64-
6568
var addinsDir = BuildSettings.ZipImageDirectory + "bin/net462/addins/";
6669
_context.CreateDirectory(addinsDir);
6770

0 commit comments

Comments
 (0)