Skip to content

Commit b7c457b

Browse files
committed
Add integration test
1 parent 6207cae commit b7c457b

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/coverlet.integration.tests/DotnetTool.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,5 +120,28 @@ public void StandAloneThresholdLineAndMethod()
120120
Assert.Contains("The minimum line coverage is below the specified 80", standardOutput);
121121
Assert.Contains("The minimum method coverage is below the specified 80", standardOutput);
122122
}
123+
124+
[Fact]
125+
public void StandAlonePathMapping()
126+
{
127+
using ClonedTemplateProject clonedTemplateProject = CloneTemplateProject();
128+
UpdateNugeConfigtWithLocalPackageFolder(clonedTemplateProject.ProjectRootPath!);
129+
string coverletToolCommandPath = InstallTool(clonedTemplateProject.ProjectRootPath!);
130+
DotnetCli($"build {clonedTemplateProject.ProjectRootPath} /p:ContinuousIntegrationBuild=true", out string standardOutput, out string standardError);
131+
string publishedTestFile = clonedTemplateProject.GetFiles("*" + ClonedTemplateProject.AssemblyName + ".dll").Single(f => !f.Contains("obj") && !f.Contains("ref"));
132+
133+
string mappingFile = Path.Combine(clonedTemplateProject.ProjectRootPath, "CoverletMapping.txt");
134+
File.WriteAllLines(mappingFile, new string[]
135+
{
136+
$"|{clonedTemplateProject.ProjectRootPath}{Path.DirectorySeparatorChar}=/_/"
137+
});
138+
RunCommand(coverletToolCommandPath, $"\"{publishedTestFile}\" --target \"dotnet\" --targetargs \"test {Path.Combine(clonedTemplateProject.ProjectRootPath, ClonedTemplateProject.ProjectFileName)} --no-build\" --include-test-assembly --output \"{clonedTemplateProject.ProjectRootPath}\"{Path.DirectorySeparatorChar} --use-mapping-file \"{mappingFile}\"", out standardOutput, out standardError);
139+
if (!string.IsNullOrEmpty(standardError))
140+
{
141+
_output.WriteLine(standardError);
142+
}
143+
Assert.Contains("Passed!", standardOutput);
144+
AssertCoverage(clonedTemplateProject, standardOutput: standardOutput);
145+
}
123146
}
124147
}

0 commit comments

Comments
 (0)