From 68d6d210206bb94c49d163369c13023f704d1bc2 Mon Sep 17 00:00:00 2001 From: shadowusr <58862284+shadowusr@users.noreply.github.com> Date: Thu, 14 Sep 2023 09:38:39 +0300 Subject: [PATCH] fix: save actual image even when errImg is not available (#504) --- lib/image-handler.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/image-handler.ts b/lib/image-handler.ts index b26eba87a..f6a011ac4 100644 --- a/lib/image-handler.ts +++ b/lib/image-handler.ts @@ -14,7 +14,8 @@ import { ImageInfo, ImageInfoError, ImageInfoFail, ImageInfoFull, - ImagesSaver + ImagesSaver, + ImageSize } from './types'; import {ERROR, FAIL, PluginEvents, SUCCESS, TestStatus, UPDATED} from './constants'; import {getError, getShortMD5, isImageDiffError, isNoRefImageError, logger, mkTestId} from './common-utils'; @@ -97,11 +98,11 @@ export class ImageHandler extends EventEmitter2 implements ImagesInfoFormatter { }; } - if (assertViewStatus === ERROR && errImg) { + if (assertViewStatus === ERROR) { return { actualImg: { path: testResult.state?.name ? this._getImgFromStorage(currPath) : '', - size: currImg?.size || errImg.size + size: (currImg?.size || errImg?.size) as ImageSize } }; }