Merge pull request #9963 from tschaub/rendering-tests

Update to work with globby@10
This commit is contained in:
Tim Schaub
2019-09-23 16:57:54 +02:00
committed by GitHub

View File

@@ -184,7 +184,7 @@ async function copyActualToExpected(entry) {
async function renderEach(page, entries, options) { async function renderEach(page, entries, options) {
let fail = false; let fail = false;
for (const entry of entries) { for (const entry of entries) {
const {tolerance = 0, message = ''} = await renderPage(page, entry, options); const {tolerance = 0.001, message = ''} = await renderPage(page, entry, options);
if (options.fix) { if (options.fix) {
await copyActualToExpected(entry); await copyActualToExpected(entry);
@@ -204,7 +204,7 @@ async function renderEach(page, entries, options) {
} }
if (mismatch > tolerance) { if (mismatch > tolerance) {
options.log.error(`${detail}': mismatch ${mismatch.toFixed(3)}`); options.log.error(`${detail}': mismatch ${mismatch}`);
fail = true; fail = true;
} else { } else {
options.log.info(`${detail}': ok`); options.log.info(`${detail}': ok`);
@@ -251,11 +251,11 @@ async function render(entries, options) {
} }
async function getLatest(patterns) { async function getLatest(patterns) {
const stats = await globby(patterns, {stats: true}); const infoList = await globby(patterns, {stats: true});
let latest = 0; let latest = 0;
for (const stat of stats) { for (const info of infoList) {
if (stat.mtime > latest) { if (info.stats.mtime > latest) {
latest = stat.mtime; latest = info.stats.mtime;
} }
} }
return latest; return latest;