testSequencer.js 639 字节
Newer Older
1
const Sequencer = require("@jest/test-sequencer").default
2
const sortTestFilePaths = [
3
  "pages/component/view/view.test.js",
4
  "pages/API/pull-down-refresh/pull-down-refresh.test.js",
5
  "pages/component/global-events/global-events.test.js",
6
  "pages/component/list-view/list-view-refresh.test.js"
7
]
8 9 10 11 12 13 14 15 16 17 18 19 20
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