App-Test-Generator
view release on metacpan or search on metacpan
bin/test-generator-index view on Meta::CPAN
my @html; # build in array, join later
push @html, <<"HTML";
<!DOCTYPE html>
<html>
<head>
<title>$config{package_name} Coverage Report</title>
<style>
body { font-family: sans-serif; }
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid #ccc; padding: 8px; text-align: left; }
th { background-color: #f2f2f2; }
.low { background-color: #fdd; }
.med { background-color: #ffd; }
.high { background-color: #dfd; }
.badges img { margin-right: 10px; }
.disabled-icon {
opacity: 0.4;
cursor: default;
}
.icon-link {
text-decoration: none;
}
.icon-link:hover {
opacity: 0.7;
cursor: pointer;
}
.coverage-badge {
padding: 2px 6px;
border-radius: 4px;
font-weight: bold;
color: white;
font-size: 0.9em;
}
.badge-good { background-color: #4CAF50; }
.badge-warn { background-color: #FFC107; }
.badge-bad { background-color: #F44336; }
.summary-row {
font-weight: bold;
background-color: #f0f0f0;
}
td.positive { color: green; font-weight: bold; }
td.negative { color: red; font-weight: bold; }
td.neutral { color: gray; }
/* Show cursor points on the headers to show that they are clickable */
th { background-color: #f2f2f2; cursor: pointer; }
th.sortable {
cursor: pointer;
user-select: none;
white-space: nowrap;
}
th .arrow {
color: #aaa; /* dimmed for inactive */
font-weight: normal;
}
th .arrow.active {
color: #000; /* dark for active */
font-weight: bold;
}
.sparkline {
display: inline-block;
vertical-align: middle;
}
tr.cpan-fail td {
background-color: #fdd;
}
tr.cpan-unknown td {
background-color: #eee;
color: #666;
}
tr.cpan-na td {
background-color: #ffffde;
color: #666;
}
.new-failure {
background: #c00;
color: #fff;
font-weight: bold;
padding: 2px 6px;
border-radius: 4px;
font-size: 0.85em;
}
.notice {
padding: 8px 12px;
margin: 10px 0;
border-radius: 4px;
font-size: 0.95em;
}
.notice strong {
font-weight: bold;
}
.notice.perl-version-cliff {
background-color: #fff3cd; /* soft amber */
border: 1px solid #ffeeba;
color: #856404;
}
.notice.perl-version-cliff a {
color: #533f03;
text-decoration: underline;
}
.notice.perl-version-cliff a:hover {
text-decoration: none;
}
.notice.locale-cliff {
border-left: 4px solid #d97706;
background: #fffbeb;
padding: 0.5em 1em;
}
.notice.rt-issues {
background: #fff6e5;
border-left: 4px solid #d9822b;
}
table.root-causes {
border-collapse: collapse;
width: 100%;
margin-bottom: 1.5em;
}
table.root-causes th,
table.root-causes td {
border: 1px solid #ccc;
padding: 8px;
vertical-align: top;
}
table.root-causes tr.high {
background-color: #dfd;
}
table.root-causes tr.med {
background-color: #ffd;
}
table.root-causes tr.low {
background-color: #fdd;
}
</style>
</head>
<body>
<div class="badges">
<a href="https://github.com/$config{github_user}/$config{github_repo}">
<img src="https://img.shields.io/github/stars/$config{github_user}/$config{github_repo}?style=social" alt="GitHub stars">
</a>
<img src="$coverage_badge_url" alt="Coverage badge">
</div>
bin/test-generator-index view on Meta::CPAN
}
})();
const ctx = document.getElementById('coverageTrend').getContext('2d');
const chart = new Chart(ctx, {
type: 'line',
data: {
datasets: [{
label: 'Total Coverage (%)',
data: dataPoints,
borderColor: 'green',
backgroundColor: 'rgba(0,128,0,0.1)',
pointRadius: 5,
pointHoverRadius: 7,
pointStyle: 'circle',
fill: false,
tension: 0.3,
pointBackgroundColor: function(context) {
return context.raw.pointBackgroundColor || 'gray';
}
}, {
label: 'Regression Line',
bin/test-generator-index view on Meta::CPAN
# >= med_threshold -> green (badge-good)
# >= low_threshold -> yellow (badge-warn)
# < low_threshold -> red (badge-bad)
# Undef input produces a grey badge with
# title="No data".
# --------------------------------------------------
sub _ter_badge {
my ($pct, $label) = @_;
unless(defined $pct) {
return qq{<span class="coverage-badge" style="background-color:#999" title="No data">$label</span>};
}
my ($class, $tooltip) =
$pct >= $config{med_threshold} ? ('badge-good', 'Excellent') :
$pct >= $config{low_threshold} ? ('badge-warn', 'Moderate') :
('badge-bad', 'Needs improvement');
return sprintf(
'<span class="coverage-badge %s" title="%s">%.1f%%</span>',
$class, $tooltip, $pct
bin/test-generator-index view on Meta::CPAN
--killed: #1e4620;
--border: #555;
}
/* --------------------------------------------------
Global Styles
-------------------------------------------------- */
body {
font-family: sans-serif;
background: var(--bg);
color: var(--text);
}
table {
border-collapse: collapse;
width: 100%;
}
th {
background: var(--table-header);
color: var(--table-header-text);
}
.survived-1 { background-color: var(--survived-1); }
.survived-2 { background-color: var(--survived-2); }
.survived-3 { background-color: var(--survived-3); }
.killed { background-color: var(--killed); }
.legend {
border: 1px solid #ccc;
background: #fafafa;
padding: 10px;
margin: 15px 0;
font-size: 0.9em;
}
.legend pre {
background: #f4f4f4;
padding: 5px;
}
.legend-box {
display: inline-block;
width: 16px;
height: 16px;
margin: 0 6px 0 20px;
vertical-align: middle;
border: 1px solid var(--border);
}
/* White box for non-mutated lines */
.legend-box.none {
background-color: var(--bg);
}
/* --------------------------------------------------
Suggested Test Box Styling
Theme-aware and readable in light & dark modes
-------------------------------------------------- */
.suggested-test {
margin-top: 6px;
margin-bottom: 12px;
/* Use theme variables instead of hardcoded colors */
background: var(--bg);
color: var(--text);
padding: 8px;
border-radius: 4px;
/* Subtle border for visual separation */
border: 1px solid var(--border);
}
/* Label styling */
.suggest-label {
font-weight: bold;
margin-bottom: 4px;
}
/* Ensure the test code block inherits readable colors */
.suggested-test pre {
background: transparent; /* Prevent nested dark blocks */
color: inherit; /* Match theme text color */
margin: 0;
font-family: monospace;
}
pre { line-height: 1.4; }
pre > details {
margin: 0.2em 0;
}
bin/test-generator-index view on Meta::CPAN
position: relative;
cursor: help;
}
/* Tooltip bubble */
.tooltip:hover::after {
content: attr(data-tooltip);
position: absolute;
left: 0;
top: 100%;
background: var(--table-header);
color: var(--table-header-text);
padding: 6px 10px;
white-space: normal;
max-width: 300px;
min-width: 30ch;
font-size: 12px;
border-radius: 6px;
z-index: 1000;
margin-left: 10ch; /* move tooltip ~10 characters to the right */
}
bin/test-generator-index view on Meta::CPAN
margin-right: 3px;
}
.lcsaj-tip {
position: relative;
display: inline-block;
}
.lcsaj-tip .lcsaj-tip-text {
visibility: hidden;
background-color: #333;
color: #fff;
padding: 4px 8px;
border-radius: 4px;
font-size: 11px;
white-space: nowrap;
position: fixed;
z-index: 9999;
pointer-events: none;
}
( run in 0.776 second using v1.01-cache-2.11-cpan-f4a522933cf )