2023-05-22 00:31:45 -05:00
|
|
|
import { createRequire } from 'node:module';
|
|
|
|
|
|
|
|
const require = createRequire(import.meta.url);
|
|
|
|
const Sequencer = require('@jest/test-sequencer').default;
|
|
|
|
|
2023-09-12 05:42:15 -05:00
|
|
|
const bootstrapTestSuitePathSuffix = '/bootstrap.test.js';
|
2023-05-22 00:31:45 -05:00
|
|
|
|
|
|
|
class CustomSequencer extends Sequencer {
|
|
|
|
sort(tests) {
|
2023-09-14 04:28:00 -05:00
|
|
|
// Let the bootstrap test suite does its job first
|
|
|
|
const bootstrap = tests.filter(({ path }) => path.endsWith(bootstrapTestSuitePathSuffix));
|
2023-05-22 00:31:45 -05:00
|
|
|
return [
|
2023-09-14 04:28:00 -05:00
|
|
|
...bootstrap,
|
|
|
|
...tests.filter(({ path }) => !path.endsWith(bootstrapTestSuitePathSuffix)),
|
2023-05-22 00:31:45 -05:00
|
|
|
].filter(Boolean);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default CustomSequencer;
|