(test)
| 113 | } |
| 114 | |
| 115 | async 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 | |
| 163 | module.exports = async function(testDir) { |
| 164 | let sections = []; |
no test coverage detected
searching dependent graphs…