From 7f5c5204e30cb334d49c7ec6dc71ff8dbce382ae Mon Sep 17 00:00:00 2001 From: Stacey Van Herk <13419300+svanherk@users.noreply.github.com> Date: Thu, 22 Jun 2023 15:30:47 -0400 Subject: [PATCH] Code review refactors --- src/server/visual-diff-plugin.js | 8 +++++--- src/server/wtr-config.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/server/visual-diff-plugin.js b/src/server/visual-diff-plugin.js index c8faa357..970bf629 100644 --- a/src/server/visual-diff-plugin.js +++ b/src/server/visual-diff-plugin.js @@ -24,9 +24,11 @@ async function clearDir(updateGoldens, path) { if (updateGoldens) { await rm(path, { force: true, recursive: true }); } else { - await rm(join(path, PATHS.FAIL), { force: true, recursive: true }); - await rm(join(path, PATHS.PASS), { force: true, recursive: true }); - await rm(join(path, 'report.html'), { force: true }); + await Promise.all([ + rm(join(path, PATHS.FAIL), { force: true, recursive: true }), + rm(join(path, PATHS.PASS), { force: true, recursive: true }), + rm(join(path, 'report.html'), { force: true }) + ]); } } diff --git a/src/server/wtr-config.js b/src/server/wtr-config.js index dd21b77d..0c794e88 100644 --- a/src/server/wtr-config.js +++ b/src/server/wtr-config.js @@ -188,7 +188,7 @@ export class WTRConfig { //config.reporters.push(visualDiffReporter()); config.plugins ??= []; - config.plugins.push(visualDiff({ updateGoldens: golden, runSubset: filter?.length > 0 || grep?.length > 0 })); + config.plugins.push(visualDiff({ updateGoldens: golden, runSubset: !!(filter || grep) })); config.groups.push(this.visualDiffGroup); }