MCPcopy
hub / github.com/apache/echarts / genDetail

Function genDetail

test/runTest/genReport.js:115–161  ·  view source on GitHub ↗
(test)

Source from the content-addressed store, hash-verified

113}
114
115async function genDetail(test) {
116 let shotDetail = '';
117 let prevShotDesc = '';
118 let failed = 0;
119 for (let shot of test.results) {
120 if (shot.diffRatio < 0.001) {
121 continue;
122 }
123 failed++;
124
125 // Batch same description shot
126 if (shot.desc !== prevShotDesc) {
127 shotDetail += `\n#### ${shot.desc}`;
128 prevShotDesc = shot.desc;
129 }
130
131 let [expectedUrl, actualUrl, diffUrl] = await Promise.all([
132 inlineImage(shot.expected),
133 inlineImage(shot.actual),
134 inlineImage(shot.diff)
135 // resolveImagePath(shot.expected),
136 // resolveImagePath(shot.actual),
137 // resolveImagePath(shot.diff)
138 ]);
139 shotDetail += `
140<div class="diff-container">
141<figure class="diff-figure">
142 <img src="${expectedUrl}" />
143 <figcaption>Expected ${test.expectedVersion}</figcaption>
144</figure>
145<figure class="diff-figure">
146 <img src="${actualUrl}" />
147 <figcaption>Actual ${test.actualVersion}</figcaption>
148</figure>
149<figure class="diff-figure">
150 <img src="${diffUrl}" />
151 <figcaption>Diff(${shot.diffRatio && shot.diffRatio.toFixed(3)})</figcaption>
152</figure>
153</div>
154`;
155 }
156 return {
157 content: shotDetail,
158 failed,
159 total: test.results.length
160 };
161}
162
163module.exports = async function(testDir) {
164 let sections = [];

Callers 1

genReport.jsFile · 0.85

Calls 2

inlineImageFunction · 0.85
toFixedMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…