Run tests alphabetically

This commit is contained in:
Diego Mello 2023-02-16 10:13:11 -03:00
parent bff57991d0
commit 2ef69a80db
2 changed files with 14 additions and 1 deletions

View File

@ -1,7 +1,8 @@
/** @type {import('@jest/types').Config.InitialOptions} */
module.exports = {
rootDir: '..',
testMatch: ['<rootDir>/e2e/tests/**/*.spec.ts'],
testSequencer: '<rootDir>/e2e/testSequencer.js',
testMatch: ['<rootDir>/e2e/tests/assorted/*.spec.ts'],
testTimeout: 120000,
maxWorkers: 1,
globalSetup: '<rootDir>/e2e/globalSetup.ts',

12
e2e/testSequencer.js Normal file
View File

@ -0,0 +1,12 @@
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) => (testA.path > testB.path ? 1 : -1));
}
}
module.exports = CustomSequencer;