diff --git a/index.html b/index.html index c3ff205f658fda3bafb49b1b8d13a02d0093b954..68275bef2492e0548e458733d42801a8bee4b619 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 0f7cba3a9cf311363a70c5acf4ce0de0db81cf24..5d4c879bd61752714810ddda2dd7b200ea9718c9 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) {