-
-
Notifications
You must be signed in to change notification settings - Fork 283
Expand file tree
/
Copy pathvitest.integration.sequencer.ts
More file actions
24 lines (19 loc) · 860 Bytes
/
vitest.integration.sequencer.ts
File metadata and controls
24 lines (19 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import path from 'node:path'
import { BaseSequencer, type TestSpecification } from 'vitest/node'
const testOrder = ['*', 'tus.test.ts', 's3-protocol.test.ts', 'rls.test.ts'] as const
export default class IntegrationSequencer extends BaseSequencer {
async sort(files: TestSpecification[]): Promise<TestSpecification[]> {
const testBuckets = Object.fromEntries(
testOrder.map((entry) => [entry, [] as TestSpecification[]])
) as Record<(typeof testOrder)[number], TestSpecification[]>
for (const file of files) {
const fileName = path.basename(file.moduleId)
const bucket = testBuckets[fileName as keyof typeof testBuckets] ?? testBuckets['*']
bucket.push(file)
}
const sortedBuckets = await Promise.all(
testOrder.map((entry) => super.sort(testBuckets[entry]))
)
return sortedBuckets.flat()
}
}