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

test: 通过限制测试顺序,规避 pullDownRefresh 测试手势操作被弹框影响问题

上级 41d1dbfe
// 自动化测试 const path = require('path')
// 备注:
//
// 1. testPathIgnorePatterns 忽略/pages/API的几条用例,是因为在ios设备上,运行会导致app崩溃。后期完成后,再去除。
// 2. testPathIgnorePatterns 忽略webview相关用例, 是因为采用app-webview方式后,不需要这两个用例。请勿修改和提交到Git。
//
module.exports = { module.exports = {
testTimeout: 30000, testTimeout: 30000,
...@@ -15,8 +9,7 @@ module.exports = { ...@@ -15,8 +9,7 @@ module.exports = {
testMatch: ["<rootDir>/pages/**/*test.[jt]s?(x)"], testMatch: ["<rootDir>/pages/**/*test.[jt]s?(x)"],
testPathIgnorePatterns: [ testPathIgnorePatterns: [
'/node_modules/', '/node_modules/',
'<rootDir>/pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js',
'<rootDir>/pages/webview-screenshot/webview-screenshot.test.js'
], ],
setupFilesAfterEnv: ['<rootDir>/jest-setup.js'], setupFilesAfterEnv: ['<rootDir>/jest-setup.js'],
testSequencer: path.join(__dirname, "testSequencer.js")
} }
const Sequencer = require("@jest/test-sequencer").default
const sortTestFilePaths = ["/pages/API/pull-down-refresh/pull-down-refresh.test.js"]
class CustomSequencer extends Sequencer {
sort(tests) {
// 测试例排序
const sortedTests = sortTestFilePaths
.map((filePath) => {
return tests.find((test) => test.path.endsWith(filePath))
})
.filter(Boolean)
return [...new Set([...sortedTests, ...tests])]
}
}
module.exports = CustomSequencer
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册