提交 26658618 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

test: 优化测试逻辑,兼容 ios

上级 f625e055
......@@ -15,6 +15,6 @@
</head>
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/main.js"></script>
<script type="module" src="/main"></script>
</body>
</html>
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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册