|
2 | 2 | #tool "nuget:?package=GitReleaseNotes"
|
3 | 3 | #addin nuget:?package=Cake.Json
|
4 | 4 | #addin nuget:?package=Newtonsoft.Json
|
5 |
| -#tool "nuget:?package=OpenCover" |
6 | 5 | #tool "nuget:?package=ReportGenerator"
|
7 | 6 | #tool "nuget:?package=coveralls.net&version=0.7.0"
|
8 |
| -#addin Cake.Coveralls&version=0.7.0 |
| 7 | +#addin Cake.Coveralls&version=0.10.1 |
9 | 8 |
|
10 | 9 | // compile
|
11 | 10 | var compileConfig = Argument("configuration", "Release");
|
@@ -119,27 +118,20 @@ Task("RunUnitTests")
|
119 | 118 | .IsDependentOn("Compile")
|
120 | 119 | .Does(() =>
|
121 | 120 | {
|
| 121 | + var testSettings = new DotNetCoreTestSettings |
| 122 | + { |
| 123 | + Configuration = compileConfig, |
| 124 | + ResultsDirectory = artifactsForUnitTestsDir, |
| 125 | + ArgumentCustomization = args => args |
| 126 | + .Append("--settings test/Ocelot.UnitTests/UnitTests.runsettings") |
| 127 | + }; |
| 128 | + |
| 129 | + EnsureDirectoryExists(artifactsForUnitTestsDir); |
| 130 | + DotNetCoreTest(unitTestAssemblies, testSettings); |
| 131 | + |
122 | 132 | if (IsRunningOnWindows())
|
123 | 133 | {
|
124 |
| - var coverageSummaryFile = artifactsForUnitTestsDir + File("coverage.xml"); |
125 |
| - |
126 |
| - EnsureDirectoryExists(artifactsForUnitTestsDir); |
127 |
| - |
128 |
| - OpenCover(tool => |
129 |
| - { |
130 |
| - tool.DotNetCoreTest(unitTestAssemblies); |
131 |
| - }, |
132 |
| - new FilePath(coverageSummaryFile), |
133 |
| - new OpenCoverSettings() |
134 |
| - { |
135 |
| - Register="user", |
136 |
| - ArgumentCustomization=args=>args.Append(@"-oldstyle -returntargetcode -excludebyattribute:*.ExcludeFromCoverage*") |
137 |
| - } |
138 |
| - .WithFilter("+[Ocelot*]*") |
139 |
| - .WithFilter("-[xunit*]*") |
140 |
| - .WithFilter("-[Ocelot*Tests]*") |
141 |
| - ); |
142 |
| - |
| 134 | + var coverageSummaryFile = GetSubDirectories(artifactsForUnitTestsDir).First().CombineWithFilePath(File("coverage.opencover.xml")); |
143 | 135 | ReportGenerator(coverageSummaryFile, artifactsForUnitTestsDir);
|
144 | 136 |
|
145 | 137 | if (AppVeyor.IsRunningOnAppVeyor)
|
@@ -171,17 +163,6 @@ Task("RunUnitTests")
|
171 | 163 | var whereToCheck = !AppVeyor.IsRunningOnAppVeyor ? coverallsRepo : artifactsForUnitTestsDir;
|
172 | 164 | throw new Exception(string.Format("Code coverage fell below the threshold of {0}%. You can find the code coverage report at {1}", minCodeCoverage, whereToCheck));
|
173 | 165 | };
|
174 |
| - |
175 |
| - } |
176 |
| - else |
177 |
| - { |
178 |
| - var settings = new DotNetCoreTestSettings |
179 |
| - { |
180 |
| - Configuration = compileConfig, |
181 |
| - }; |
182 |
| - |
183 |
| - EnsureDirectoryExists(artifactsForUnitTestsDir); |
184 |
| - DotNetCoreTest(unitTestAssemblies, settings); |
185 | 166 | }
|
186 | 167 | });
|
187 | 168 |
|
|
0 commit comments