[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
12

Configure Feed

Select the types of activity you want to include in your feed.

perf(pool): sort test files by project by default (#8914)

authored by

Ari Perkkiö and committed by
GitHub
(Nov 3, 2025, 5:03 PM +0100) 680a612e fdb2e798

+21 -7
-6
test/coverage-test/vitest.config.ts
··· 19 19 extends: true, 20 20 test: { 21 21 name: { label: 'v8', color: 'green' }, 22 - sequence: { groupOrder: 1 }, 23 22 env: { COVERAGE_PROVIDER: 'v8' }, 24 23 include: [GENERIC_TESTS, V8_TESTS], 25 24 exclude: [ ··· 37 36 extends: true, 38 37 test: { 39 38 name: { label: 'istanbul', color: 'magenta' }, 40 - sequence: { groupOrder: 2 }, 41 39 env: { COVERAGE_PROVIDER: 'istanbul' }, 42 40 include: [GENERIC_TESTS, ISTANBUL_TESTS], 43 41 exclude: [ ··· 55 53 extends: true, 56 54 test: { 57 55 name: { label: 'custom', color: 'yellow' }, 58 - sequence: { groupOrder: 3 }, 59 56 env: { COVERAGE_PROVIDER: 'custom' }, 60 57 include: [CUSTOM_TESTS], 61 58 exclude: [FIXTURES], ··· 67 64 extends: true, 68 65 test: { 69 66 name: { label: 'istanbul-browser', color: 'blue' }, 70 - sequence: { groupOrder: 4 }, 71 67 env: { COVERAGE_PROVIDER: 'istanbul', COVERAGE_BROWSER: 'true' }, 72 68 testTimeout: 15_000, 73 69 include: [ ··· 99 95 extends: true, 100 96 test: { 101 97 name: { label: 'v8-browser', color: 'red' }, 102 - sequence: { groupOrder: 5 }, 103 98 env: { COVERAGE_PROVIDER: 'v8', COVERAGE_BROWSER: 'true' }, 104 99 testTimeout: 15_000, 105 100 include: [ ··· 133 128 extends: true, 134 129 test: { 135 130 name: { label: 'unit', color: 'cyan' }, 136 - sequence: { groupOrder: 6 }, 137 131 include: [UNIT_TESTS], 138 132 typecheck: { 139 133 enabled: true,
+2 -1
test/core/test/sequencers.test.ts
··· 7 7 function buildCtx(config?: Partial<Vitest['config']>) { 8 8 return { 9 9 config: { 10 - sequence: {}, 10 + sequence: { groupOrder: 0 }, 11 11 ...config, 12 12 }, 13 13 cache: { ··· 22 22 name: 'test', 23 23 config: { 24 24 root: import.meta.dirname, 25 + sequence: { groupOrder: 0 }, 25 26 }, 26 27 } as any as TestProject 27 28 }
+19
packages/vitest/src/node/sequencers/BaseSequencer.ts
··· 35 35 public async sort(files: TestSpecification[]): Promise<TestSpecification[]> { 36 36 const cache = this.ctx.cache 37 37 return [...files].sort((a, b) => { 38 + // "sequence.groupOrder" is higher priority 39 + const groupOrderDiff = a.project.config.sequence.groupOrder - b.project.config.sequence.groupOrder 40 + if (groupOrderDiff !== 0) { 41 + return groupOrderDiff 42 + } 43 + 44 + // Projects run sequential 45 + if (a.project.name !== b.project.name) { 46 + return a.project.name < b.project.name ? -1 : 1 47 + } 48 + 49 + // Isolated run first 50 + if (a.project.config.isolate && !b.project.config.isolate) { 51 + return -1 52 + } 53 + if (!a.project.config.isolate && b.project.config.isolate) { 54 + return 1 55 + } 56 + 38 57 const keyA = `${a.project.name}:${relative(this.ctx.config.root, a.moduleId)}` 39 58 const keyB = `${b.project.name}:${relative(this.ctx.config.root, b.moduleId)}` 40 59