Skip to content

Commit 27932b4

Browse files
committed
fix coverlet.msbuild.tasks integartion tests
1 parent 1e09a04 commit 27932b4

File tree

4 files changed

+9
-17
lines changed

4 files changed

+9
-17
lines changed

src/coverlet.core/coverlet.core.csproj

+1-9
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Library</OutputType>
5-
<TargetFrameworks>netstandard2.0</TargetFrameworks>
5+
<TargetFramework>netstandard2.0</TargetFramework>
66
<IsPackable>false</IsPackable>
77
</PropertyGroup>
88

@@ -15,14 +15,6 @@
1515
<PackageReference Include="NuGet.Versioning" />
1616
<PackageReference Include="Newtonsoft.Json" />
1717
<PackageReference Include="System.Text.Json" VersionOverride="6.0.11" />
18-
</ItemGroup>
19-
20-
<ItemGroup Condition="'$(TargetFramework)' != 'netstandard2.0'">
21-
<PackageReference Include="System.Reflection.Metadata" VersionOverride="6.0.2" />
22-
<PackageReference Include="System.Collections.Immutable" VersionOverride="6.0.1" />
23-
</ItemGroup>
24-
25-
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
2618
<PackageReference Include="System.Reflection.Metadata" VersionOverride="$(SystemReflectionMetadataVersion)" />
2719
<PackageReference Include="System.Collections.Immutable" VersionOverride="$(SystemCollectionsImmutableVersion)" />
2820
<PackageReference Include="System.Buffers" />

src/coverlet.msbuild.tasks/coverlet.msbuild.tasks.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<OutputType>Library</OutputType>
@@ -60,7 +60,7 @@
6060
</None>
6161
</ItemGroup>
6262

63-
<Target Name="PackBuildOutputs">
63+
<Target Name="PackBuildOutputs" DependsOnTargets="BuildOnlySettings;ResolveReferences">
6464
<ItemGroup>
6565
<TfmSpecificPackageFile Include="$(TargetPath)" PackagePath="tasks\$(TargetFramework)" />
6666
<TfmSpecificPackageFile Include="$(ProjectDepsFilePath)" PackagePath="tasks\$(TargetFramework)" />

test/coverlet.integration.template/coverlet.integration.template.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net8.0</TargetFrameworks>
4+
<TargetFramework>net8.0</TargetFramework>
55
<IsPackable>false</IsPackable>
66
<AssemblyName>coverletsamplelib.integration.template</AssemblyName>
77
<IsTestProject>false</IsTestProject>

test/coverlet.integration.tests/Msbuild.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public void TestMsbuild()
4646
Assert.Equal(0, result);
4747
Assert.Contains("Passed!", standardOutput, StringComparison.Ordinal);
4848
Assert.Contains("| coverletsamplelib.integration.template | 100% | 100% | 100% |", standardOutput, StringComparison.Ordinal);
49-
string coverageFileName = $"coverage.{_buildTargetFramework}.json";
49+
string coverageFileName = $"coverage.json";
5050
Assert.True(File.Exists(Path.Combine(clonedTemplateProject.ProjectRootPath, coverageFileName)));
5151
AssertCoverage(clonedTemplateProject, coverageFileName);
5252
}
@@ -67,7 +67,7 @@ public void TestMsbuild_NoCoverletOutput()
6767
Assert.Equal(0, result);
6868
Assert.Contains("Passed!", standardOutput, StringComparison.Ordinal);
6969
Assert.Contains("| coverletsamplelib.integration.template | 100% | 100% | 100% |", standardOutput, StringComparison.Ordinal);
70-
string coverageFileName = $"coverage.{_buildTargetFramework}.json";
70+
string coverageFileName = $"coverage.json";
7171
Assert.True(File.Exists(Path.Combine(clonedTemplateProject.ProjectRootPath, coverageFileName)));
7272
AssertCoverage(clonedTemplateProject, coverageFileName);
7373
}
@@ -88,7 +88,7 @@ public void TestMsbuild_CoverletOutput_Folder_FileNameWithoutExtension()
8888
Assert.Equal(0, result);
8989
Assert.Contains("Passed!", standardOutput, StringComparison.Ordinal);
9090
Assert.Contains("| coverletsamplelib.integration.template | 100% | 100% | 100% |", standardOutput, StringComparison.Ordinal);
91-
string coverageFileName = $"file.{_buildTargetFramework}.json";
91+
string coverageFileName = $"file.json";
9292
Assert.True(File.Exists(Path.Combine(clonedTemplateProject.ProjectRootPath, coverageFileName)));
9393
AssertCoverage(clonedTemplateProject, coverageFileName);
9494
}
@@ -100,7 +100,7 @@ public void TestMsbuild_CoverletOutput_Folder_FileNameExtension()
100100
Assert.Equal(0, DotnetCli($"test -c {_buildConfiguration} -f {_buildTargetFramework} \"{clonedTemplateProject.ProjectRootPath}\" /p:CollectCoverage=true /p:Include=\"[{ClonedTemplateProject.AssemblyName}]*DeepThought\" /p:IncludeTestAssembly=true /p:CoverletOutput=\"{clonedTemplateProject.ProjectRootPath}\"\\file.ext", out string standardOutput, out string standardError));
101101
Assert.Contains("Passed!", standardOutput, StringComparison.Ordinal);
102102
Assert.Contains("| coverletsamplelib.integration.template | 100% | 100% | 100% |", standardOutput, StringComparison.Ordinal);
103-
string coverageFileName = $"file.{_buildTargetFramework}.ext";
103+
string coverageFileName = $"file.ext";
104104
Assert.True(File.Exists(Path.Combine(clonedTemplateProject.ProjectRootPath, coverageFileName)));
105105
AssertCoverage(clonedTemplateProject, coverageFileName);
106106
}
@@ -143,7 +143,7 @@ public void TestMsbuild_CoverletOutput_Folder_FileNameWithDoubleExtension()
143143
}
144144
Assert.Contains("Passed!", standardOutput, StringComparison.Ordinal);
145145
Assert.Contains("| coverletsamplelib.integration.template | 100% | 100% | 100% |", standardOutput, StringComparison.Ordinal);
146-
string coverageFileName = $"file.ext1.{_buildTargetFramework}.ext2";
146+
string coverageFileName = $"file.ext1.ext2";
147147
Assert.True(File.Exists(Path.Combine(clonedTemplateProject.ProjectRootPath, coverageFileName)));
148148
AssertCoverage(clonedTemplateProject, coverageFileName);
149149
}

0 commit comments

Comments
 (0)