From 266586187eaa3f59072edf30b14f4dbffe42cba7 Mon Sep 17 00:00:00 2001 From: zhenyuWang <13641039885@163.com> Date: Fri, 13 Sep 2024 17:03:41 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E4=BC=98=E5=8C=96=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=8C=E5=85=BC=E5=AE=B9=20ios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 2 +- pages/index/basicTest.test.js | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index c3ff205..68275be 100644 --- a/index.html +++ b/index.html @@ -15,6 +15,6 @@
- + diff --git a/pages/index/basicTest.test.js b/pages/index/basicTest.test.js index 0f7cba3..5d4c879 100644 --- a/pages/index/basicTest.test.js +++ b/pages/index/basicTest.test.js @@ -1,6 +1,6 @@ const ERR_RE = /expected:<(.*)> but was:<(.*)>/ - let result; +const resultEmptyError = '获取到 result 是空的, 请运行项目进行排查' beforeAll(async () => { await program.reLaunch('/pages/index/basicTest') @@ -11,6 +11,9 @@ beforeAll(async () => { }) function getApiFailed(describe, api) { + if(Object.keys(result).length === 0){ + return resultEmptyError + } const failed = result[describe]?.failed?.find(item => { return item.split(':')[0] === api }) @@ -22,7 +25,9 @@ describes.forEach(d => { d?.tests && d.tests.forEach(api => { it(api, () => { const failed = getApiFailed(d.describe, api) - if (failed) { + if(failed == resultEmptyError){ + expect('').toBe(resultEmptyError) + }else if (failed) { const parts = failed.split('\n') const matches = parts[1].match(ERR_RE) if (matches?.length) { -- GitLab