@@ -179,7 +179,9 @@ function getSortWrapper (sort) {
179
179
const knownTestsResponse = await getChannelPromise ( knownTestsCh )
180
180
if ( ! knownTestsResponse . err ) {
181
181
knownTests = knownTestsResponse . knownTests
182
- const testFilepaths = await this . ctx . getTestFilepaths ( )
182
+ const getFilePaths = this . ctx . getTestFilepaths || this . ctx . _globTestFilepaths
183
+
184
+ const testFilepaths = await getFilePaths . call ( this . ctx )
183
185
184
186
isEarlyFlakeDetectionFaultyCh . publish ( {
185
187
knownTests : knownTests . vitest || { } ,
@@ -492,15 +494,6 @@ addHook({
492
494
return vitestPackage
493
495
} )
494
496
495
- addHook ( {
496
- name : 'vitest' ,
497
- versions : [ '>=2.1.0' ] ,
498
- filePattern : 'dist/chunks/RandomSequencer.*'
499
- } , ( randomSequencerPackage ) => {
500
- shimmer . wrap ( randomSequencerPackage . B . prototype , 'sort' , getSortWrapper )
501
- return randomSequencerPackage
502
- } )
503
-
504
497
addHook ( {
505
498
name : 'vitest' ,
506
499
versions : [ '>=2.0.5 <2.1.0' ] ,
@@ -513,6 +506,24 @@ addHook({
513
506
return vitestPackage
514
507
} )
515
508
509
+ addHook ( {
510
+ name : 'vitest' ,
511
+ versions : [ '>=2.1.0 <3.0.0' ] ,
512
+ filePattern : 'dist/chunks/RandomSequencer.*'
513
+ } , ( randomSequencerPackage ) => {
514
+ shimmer . wrap ( randomSequencerPackage . B . prototype , 'sort' , getSortWrapper )
515
+ return randomSequencerPackage
516
+ } )
517
+
518
+ addHook ( {
519
+ name : 'vitest' ,
520
+ versions : [ '>=3.0.0' ] ,
521
+ filePattern : 'dist/chunks/resolveConfig.*'
522
+ } , ( randomSequencerPackage ) => {
523
+ shimmer . wrap ( randomSequencerPackage . B . prototype , 'sort' , getSortWrapper )
524
+ return randomSequencerPackage
525
+ } )
526
+
516
527
// Can't specify file because compiled vitest includes hashes in their files
517
528
addHook ( {
518
529
name : 'vitest' ,
@@ -533,15 +544,17 @@ addHook({
533
544
versions : [ '>=1.6.0' ] ,
534
545
file : 'dist/index.js'
535
546
} , ( vitestPackage , frameworkVersion ) => {
536
- shimmer . wrap ( vitestPackage , 'startTests' , startTests => async function ( testPath ) {
547
+ shimmer . wrap ( vitestPackage , 'startTests' , startTests => async function ( testPaths ) {
537
548
let testSuiteError = null
538
549
if ( ! testSuiteStartCh . hasSubscribers ) {
539
550
return startTests . apply ( this , arguments )
540
551
}
552
+ // From >=3.0.1, the first arguments changes from a string to an object containing the filepath
553
+ const testSuiteAbsolutePath = testPaths [ 0 ] ?. filepath || testPaths [ 0 ]
541
554
542
555
const testSuiteAsyncResource = new AsyncResource ( 'bound-anonymous-fn' )
543
556
testSuiteAsyncResource . runInAsyncScope ( ( ) => {
544
- testSuiteStartCh . publish ( { testSuiteAbsolutePath : testPath [ 0 ] , frameworkVersion } )
557
+ testSuiteStartCh . publish ( { testSuiteAbsolutePath, frameworkVersion } )
545
558
} )
546
559
const startTestsResponse = await startTests . apply ( this , arguments )
547
560
0 commit comments