@@ -179,7 +179,9 @@ function getSortWrapper (sort) {
179179 const knownTestsResponse = await getChannelPromise ( knownTestsCh )
180180 if ( ! knownTestsResponse . err ) {
181181 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 )
183185
184186 isEarlyFlakeDetectionFaultyCh . publish ( {
185187 knownTests : knownTests . vitest || { } ,
@@ -492,15 +494,6 @@ addHook({
492494 return vitestPackage
493495} )
494496
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-
504497addHook ( {
505498 name : 'vitest' ,
506499 versions : [ '>=2.0.5 <2.1.0' ] ,
@@ -513,6 +506,24 @@ addHook({
513506 return vitestPackage
514507} )
515508
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+
516527// Can't specify file because compiled vitest includes hashes in their files
517528addHook ( {
518529 name : 'vitest' ,
@@ -533,15 +544,17 @@ addHook({
533544 versions : [ '>=1.6.0' ] ,
534545 file : 'dist/index.js'
535546} , ( vitestPackage , frameworkVersion ) => {
536- shimmer . wrap ( vitestPackage , 'startTests' , startTests => async function ( testPath ) {
547+ shimmer . wrap ( vitestPackage , 'startTests' , startTests => async function ( testPaths ) {
537548 let testSuiteError = null
538549 if ( ! testSuiteStartCh . hasSubscribers ) {
539550 return startTests . apply ( this , arguments )
540551 }
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 ]
541554
542555 const testSuiteAsyncResource = new AsyncResource ( 'bound-anonymous-fn' )
543556 testSuiteAsyncResource . runInAsyncScope ( ( ) => {
544- testSuiteStartCh . publish ( { testSuiteAbsolutePath : testPath [ 0 ] , frameworkVersion } )
557+ testSuiteStartCh . publish ( { testSuiteAbsolutePath, frameworkVersion } )
545558 } )
546559 const startTestsResponse = await startTests . apply ( this , arguments )
547560
0 commit comments