Skip to content

Commit

Permalink
fix coverage summary for new version
Browse files Browse the repository at this point in the history
  • Loading branch information
cenfun committed Dec 27, 2023
1 parent d7faa22 commit 65f4677
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 37 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
"eslint-config-plus": "^1.0.6",
"eslint-plugin-html": "^7.1.0",
"eslint-plugin-vue": "^9.19.2",
"stylelint": "^16.0.2",
"stylelint": "^15.11.0",
"stylelint-config-plus": "^1.0.4",
"vine-ui": "^3.1.13"
}
}
}
67 changes: 32 additions & 35 deletions packages/reporter/src/components/detail/attachments/coverage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,8 @@ const d = shallowReactive({
list: []
});
const getIstanbulSummary = (report, list) => {
const getSummary = (summary, map, list) => {
const map = {
statements: 'Statements',
branches: 'Branches',
functions: 'Functions',
lines: 'Lines'
};
const summary = report.summary;
// console.log(summary);
Object.keys(map).forEach((k) => {
Expand All @@ -52,28 +44,32 @@ const getIstanbulSummary = (report, list) => {
list.push(item);
});
};
const getIstanbulSummary = (report, list) => {
const getV8Summary = (report, list) => {
const item = report.summary;
const map = {
statements: 'Statements',
functions: 'Functions',
branches: 'Branches',
lines: 'Lines'
};
item.name = 'Bytes';
item.totalTitle = `Total ${Util.BSF(item.total)}`;
getSummary(report.summary, map, list);
item.coveredTitle = `Covered ${Util.BSF(item.covered)}`;
item.coveredClass = item.covered > 0 ? 'mcr-covered' : '';
};
item.uncoveredTitle = `Uncovered ${Util.BSF(item.uncovered)}`;
item.uncoveredClass = item.uncovered > 0 ? 'mcr-uncovered' : '';
item.percentChart = Util.generatePercentChart(item.pct);
const getV8Summary = (report, list) => {
list.push(item);
const map = {
bytes: 'Bytes',
functions: 'Functions',
branches: 'Branches',
lines: 'Lines'
};
getSummary(report.summary, map, list);
};
Expand Down Expand Up @@ -110,11 +106,11 @@ watchEffect(() => {
<td class="mcr-column-left">
Name
</td>
<td>Total</td>
<td>Covered</td>
<td>Uncovered</td>
<td>Coverage</td>
<td />
<td>Covered</td>
<td>Uncovered</td>
<td>Total</td>
</tr>
<tr
v-for="(item, i) of d.list"
Expand All @@ -123,25 +119,26 @@ watchEffect(() => {
<td class="mcr-column-left">
<b>{{ item.name }}</b>
</td>
<td :title="item.totalTitle">
{{ Util.NF(item.total) }}
</td>
<td :title="item.coveredTitle">
<span :class="item.coveredClass">{{ Util.NF(item.covered) }}</span>
</td>
<td :title="item.uncoveredTitle">
<span :class="item.uncoveredClass">{{ Util.NF(item.uncovered) }}</span>
</td>
<td
style="padding: 0 5px;"
:class="'mcr-'+item.status"
>
{{ Util.PF(item.pct, 100) }}
{{ Util.PF(item.pct, 100, 2) }}
</td>
<td
style="min-width: 100px;"
v-html="item.percentChart"
/>

<td :title="item.coveredTitle">
<span :class="item.coveredClass">{{ Util.NF(item.covered) }}</span>
</td>
<td :title="item.uncoveredTitle">
<span :class="item.uncoveredClass">{{ Util.NF(item.uncovered) }}</span>
</td>
<td :title="item.totalTitle">
{{ Util.NF(item.total) }}
</td>
</tr>
</table>
<VuiFlex
Expand Down

0 comments on commit 65f4677

Please sign in to comment.