-
Notifications
You must be signed in to change notification settings - Fork 847
Expand file tree
/
Copy pathtestSequencer.js
More file actions
30 lines (27 loc) · 845 Bytes
/
testSequencer.js
File metadata and controls
30 lines (27 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const Sequencer = require("@jest/test-sequencer").default
const startTestFilePaths = [
"pages/App.test.js",
]
const endTestFilePaths = [
"pages/error/runtime-error/runtime-error.test.js",
"pages/error/throw-error/throw-error.test.js",
]
class CustomSequencer extends Sequencer {
sort(tests) {
const startTests = startTestFilePaths
.map((filePath) => {
return tests.find((test) => test.path.endsWith(filePath))
})
.filter(Boolean)
const endTests = endTestFilePaths
.map((filePath) => {
return tests.find((test) => test.path.endsWith(filePath))
})
.filter(Boolean)
const middleTests = tests.filter((test) =>
!startTests.includes(test) && !endTests.includes(test)
);
return [...startTests, ...middleTests, ...endTests]
}
}
module.exports = CustomSequencer