-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestSequencer.js
More file actions
24 lines (22 loc) · 917 Bytes
/
testSequencer.js
File metadata and controls
24 lines (22 loc) · 917 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
const Sequencer = require('@jest/test-sequencer').default;
class CustomSequencer extends Sequencer {
sort(tests) {
// Test structure information
// https://github.com/facebook/jest/blob/6b8b1404a1d9254e7d5d90a8934087a9c9899dab/packages/jest-runner/src/types.ts#L17-L21
const copyTests = Array.from(tests);
return copyTests.sort((testA, testB) => {
// TODO: Remove @jest/test-sequencer
// `auth-unit-test` currently causes intended side-effects related to `Credentials`
// which is causing other tests to fail. As a temporary change, we are ordering the tests
// alphabetically but putting `auth-unit-test` at the end to ensure no other tests
// are affected.
if (testA.path.includes('auth-unit-test.ts')) {
return 1;
} else if (testB.path.includes('auth-unit-test.ts')) {
return -1;
}
return testA.path > testB.path ? 1 : -1;
});
}
}
module.exports = CustomSequencer;