-
-
Notifications
You must be signed in to change notification settings - Fork 120
/
Copy pathjest.sequencer.js
33 lines (27 loc) · 930 Bytes
/
jest.sequencer.js
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
31
32
33
// eslint-disable-next-line @typescript-eslint/no-var-requires
const Sequencer = require('@jest/test-sequencer').default
// https://stackoverflow.com/a/68009048
const isRLSTest = (test) => {
return test.path.includes('rls')
}
const isTusTest = (test) => {
return test.path.includes('tus')
}
const isS3Test = (test) => {
return test.path.includes('s3')
}
class CustomSequencer extends Sequencer {
sort(tests) {
const copyTests = Array.from(tests)
const normalTests = copyTests.filter((t) => !isRLSTest(t) && !isTusTest(t) && !isS3Test(t))
const tusTests = copyTests.filter((t) => isTusTest(t))
const s3Tests = copyTests.filter((t) => isS3Test(t))
const rlsTests = copyTests.filter((t) => isRLSTest(t))
return super
.sort(normalTests)
.concat(tusTests)
.concat(s3Tests)
.concat(rlsTests.sort((a, b) => (a.path > b.path ? 1 : -1)))
}
}
module.exports = CustomSequencer