testSequencer.js 1.2 KB
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
  "pages/component/scroll-view/scroll-view-refresher.test.js",
8
  "pages/component/global-events/touch-events.test.js",
9
  "pages/component/global-events/touch-events-bubbles.test.js",
10
  "pages/component/swiper/swiper2.test.js",
11
  "pages/component/slider/slider-maxValue.test.js",
12
  "pages/CSS/overflow/overflow-visible-event.test.js",
13
  "pages/API/create-selector-query/create-selector-query-onScroll.test.js",
14
  "pages/component/scroll-view/scroll-view-custom-refresher-props.test.js",
15
  "pages/component/rich-text/rich-text-complex.test.js"
16
]
17 18 19 20 21 22 23 24 25 26 27 28 29
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