-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-sequencer.js
37 lines (29 loc) · 1.06 KB
/
test-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
34
35
36
37
// testSequencer.js
const Sequencer = require('@jest/test-sequencer').default;
// Jest Unity
// Jest integration
// Jest integration repo
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);
const currentPath = __dirname;
const processLog = process.argv;
if (processLog.includes('some_path_name')) console.log('teste');
return this.sortByTestType(tests);
}
/**
*
* Sorts testes alphabetically
* @param {string[]} tests
* @returns {string[]}
*/
sortByTestType(tests) {
const unitTests = tests.filter(test => test.path.includes('unit'));
const integrationTests = tests.filter(test => test.path.includes('integration'));
const e2eTests = tests.filter(test => test.path.includes('e2e'));
return [...unitTests, ...integrationTests, ...e2eTests];
}
}
module.exports = CustomSequencer;