1 | const Sequencer = require('@jest/test-sequencer').default;
|
2 |
|
3 | class CustomSequencer extends Sequencer {
|
4 | sort(tests) {
|
5 | // Test structure information
|
6 | // https://github.com/facebook/jest/blob/6b8b1404a1d9254e7d5d90a8934087a9c9899dab/packages/jest-runner/src/types.ts#L17-L21
|
7 | const copyTests = Array.from(tests);
|
8 | return copyTests.sort((testA, testB) => {
|
9 | // TODO: Remove @jest/test-sequencer
|
10 | // `auth-unit-test` currently causes intended side-effects related to `Credentials`
|
11 | // which is causing other tests to fail. As a temporary change, we are ordering the tests
|
12 | // alphabetically but putting `auth-unit-test` at the end to ensure no other tests
|
13 | // are affected.
|
14 | if (testA.path.includes('auth-unit-test.ts')) {
|
15 | return 1;
|
16 | } else if (testB.path.includes('auth-unit-test.ts')) {
|
17 | return -1;
|
18 | }
|
19 | return testA.path > testB.path ? 1 : -1;
|
20 | });
|
21 | }
|
22 | }
|
23 |
|
24 | module.exports = CustomSequencer;
|