testSequencer.js 483 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
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