2023-05-22 13:31:45 +08:00
|
|
|
import { createRequire } from 'node:module';
|
|
|
|
|
|
|
|
const require = createRequire(import.meta.url);
|
|
|
|
const Sequencer = require('@jest/test-sequencer').default;
|
|
|
|
|
2023-09-12 18:42:15 +08:00
|
|
|
const bootstrapTestSuitePathSuffix = '/bootstrap.test.js';
|
2023-05-22 13:31:45 +08:00
|
|
|
|
|
|
|
class CustomSequencer extends Sequencer {
|
|
|
|
sort(tests) {
|
|
|
|
const bootstrap = tests.find(({ path }) => path.includes(bootstrapTestSuitePathSuffix));
|
|
|
|
return [
|
|
|
|
bootstrap,
|
|
|
|
...tests.filter(({ path }) => !path.includes(bootstrapTestSuitePathSuffix)),
|
|
|
|
].filter(Boolean);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default CustomSequencer;
|