Skip to content

Commit b62cff1

Browse files
committed
update DeterministicBuild test
1 parent 982dd41 commit b62cff1

File tree

5 files changed

+15
-11
lines changed

5 files changed

+15
-11
lines changed

src/coverlet.core/Instrumentation/CecilAssemblyResolver.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ public RuntimeConfigurationReader(string runtimeConfigFile)
318318
return frameworksElement.EnumerateArray().Select(x => (x.GetProperty("name").GetString(), x.GetProperty("version").GetString())).ToList();
319319
}
320320

321-
if (runtimeOptionsElement.TryGetProperty("includedframeworks", out JsonElement runtimeoptionselement))
321+
if (runtimeOptionsElement.TryGetProperty("includedFrameworks", out JsonElement runtimeoptionselement))
322322
{
323323
return runtimeoptionselement.EnumerateArray().Select(x => (x.GetProperty("name").GetString(), x.GetProperty("version").GetString())).ToList();
324324
}

test/coverlet.integration.determisticbuild/coverlet.integration.determisticbuild.csproj

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<!-- Import coverlet version-->
33
<Import Project="$(MSBuildThisFileDirectory)\DeterministicTest.props" />
44

55
<PropertyGroup>
6-
<TargetFramework>net6.0</TargetFramework>
6+
<TargetFramework>net8.0</TargetFramework>
77
<IsPackable>false</IsPackable>
88
<AssemblyName>coverletsample.integration.determisticbuild</AssemblyName>
99
<MSBuildWarningsAsMessages>NU1604</MSBuildWarningsAsMessages>
@@ -24,10 +24,8 @@
2424
<PrivateAssets>all</PrivateAssets>
2525
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2626
</PackageReference>
27-
<PackageReference Include="xunit" Version="2.9.2" />
27+
<PackageReference Include="xunit" Version="2.9.3" />
2828
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
29-
<PackageReference Include="System.Buffers" Version="4.6.0" />
30-
<PackageReference Include="System.Memory" Version="4.6.0" />
3129
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="6.0.5" />
3230
</ItemGroup>
3331
</Project>

test/coverlet.integration.template/nuget.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
<configuration>
33
<packageSources>
44
<clear />
5-
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
5+
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
66
</packageSources>
77
</configuration>

test/coverlet.integration.tests/DeterministicBuild.cs

+5-3
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,17 @@ public class DeterministicBuild : BaseTest, IDisposable
3131
public DeterministicBuild(ITestOutputHelper output)
3232
{
3333
_buildConfiguration = TestUtils.GetAssemblyBuildConfiguration().ToString();
34-
//_buildTargetFramework = TestUtils.GetAssemblyTargetFramework();
3534
_output = output;
3635
_type = output.GetType();
3736
_testMember = _type.GetField("test", BindingFlags.Instance | BindingFlags.NonPublic);
3837
}
3938

4039
private void CreateDeterministicTestPropsFile()
4140
{
42-
var deterministicTestProps = new XDocument();
41+
string propsFile = Path.Combine(_testProjectPath, PropsFileName);
42+
File.Delete(propsFile);
43+
44+
XDocument deterministicTestProps = new();
4345
deterministicTestProps.Add(
4446
new XElement("Project",
4547
new XElement("PropertyGroup",
@@ -48,7 +50,7 @@ private void CreateDeterministicTestPropsFile()
4850
_testProjectTfm = XElement.Load(Path.Combine(_testProjectPath, "coverlet.integration.determisticbuild.csproj"))!.
4951
Descendants("PropertyGroup")!.Single().Element("TargetFramework")!.Value;
5052

51-
deterministicTestProps.Save(Path.Combine(_testProjectPath, PropsFileName));
53+
deterministicTestProps.Save(Path.Combine(propsFile));
5254
}
5355

5456
private protected void AssertCoverage(string standardOutput = "", bool checkDeterministicReport = true)

test/coverlet.integration.tests/DotnetTool.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ public DotnetGlobalTools(ITestOutputHelper output)
2121
}
2222
private string InstallTool(string projectPath)
2323
{
24-
_ = DotnetCli($"tool install coverlet.console --version {GetPackageVersion("*console*.nupkg")} --tool-path \"{Path.Combine(projectPath, "coverletTool")}\"", out string standardOutput, out _, projectPath);
24+
_ = DotnetCli($"tool install coverlet.console --version {GetPackageVersion("*console*.nupkg")} --tool-path \"{Path.Combine(projectPath, "coverletTool")}\"", out string standardOutput, out string standardError, projectPath);
25+
if (!string.IsNullOrEmpty(standardError))
26+
{
27+
_output.WriteLine(standardError);
28+
}
2529
Assert.Contains("was successfully installed.", standardOutput);
2630
return Path.Combine(projectPath, "coverletTool", "coverlet");
2731
}

0 commit comments

Comments
 (0)