Skip to content

Commit 4aa1063

Browse files
committed
Improve project coverage report index page
- Provide a link to the union/all coverage report. - Format the reports as a list instead of a table of one column. - Provide better explanation of what each report means.
1 parent b245f7e commit 4aa1063

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

lib/cover-project.nix

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,12 @@ coverageReports:
1010
let
1111
toBashArray = arr: "(" + (lib.concatStringsSep " " arr) + ")";
1212

13-
# Create table rows for a project coverage index page that look something like:
14-
#
15-
# | Package |
16-
# |------------------|
17-
# | cardano-shell |
18-
# | cardano-launcher |
19-
coverageTableRows = coverageReport:
13+
# Create a list element for a project coverage index page.
14+
coverageListElement = coverageReport:
2015
''
21-
<tr>
22-
<td>
23-
<a href="${coverageReport.passthru.name}/hpc_index.html">${coverageReport.passthru.name}</href>
24-
</td>
25-
</tr>
16+
<li>
17+
<a href="${coverageReport.passthru.name}/hpc_index.html">${coverageReport.passthru.name}</a>
18+
</li>
2619
'';
2720

2821
projectIndexHtml = pkgs.writeText "index.html" ''
@@ -31,16 +24,22 @@ let
3124
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
3225
</head>
3326
<body>
34-
<table border="1" width="100%">
35-
<tbody>
36-
<tr>
37-
<th>Report</th>
38-
</tr>
39-
40-
${with lib; concatStringsSep "\n" (map coverageTableRows coverageReports)}
41-
42-
</tbody>
43-
</table>
27+
<div>
28+
<h2>Union Report</h2>
29+
<p>The following report shows how each module is covered by any test in the project:</p>
30+
<ul>
31+
<li>
32+
<a href="all/hpc_index.html">all</a>
33+
</li>
34+
</ul>
35+
</div>
36+
<div>
37+
<h2>Individual Reports</h2>
38+
<p>The following reports show how each module is covered by tests in its own package:</p>
39+
<ul>
40+
${with lib; concatStringsSep "\n" (map coverageListElement coverageReports)}
41+
</ul>
42+
</div>
4443
</body>
4544
</html>
4645
'';

0 commit comments

Comments
 (0)