@@ -465,59 +465,7 @@ test("getGitVersionOrThrow throws when git command fails", async (t) => {
465465}
466466} ) ;
467467
468- test ( "getGitVersion returns version and caches it" , async ( t ) => {
469- gitUtils . resetCachedGitVersion ( ) ;
470- const runGitCommandStub = sinon
471- . stub ( gitUtils as any , "runGitCommand" )
472- . resolves ( "git version 2.40.0\n" ) ;
473-
474- const messages :LoggedMessage [ ] = [ ] ;
475- const logger = getRecordingLogger ( messages ) ;
476-
477- try {
478- // First call should fetch and cache
479- const version1 = await gitUtils . getGitVersion ( logger ) ;
480- t . is ( version1 , "2.40.0" ) ;
481- t . is ( runGitCommandStub . callCount , 1 ) ;
482-
483- // Second call should use cache
484- const version2 = await gitUtils . getGitVersion ( logger ) ;
485- t . is ( version2 , "2.40.0" ) ;
486- t . is ( runGitCommandStub . callCount , 1 ) ; // Should still be 1
487- } finally {
488- runGitCommandStub . restore ( ) ;
489- gitUtils . resetCachedGitVersion ( ) ;
490- }
491- } ) ;
492-
493- test ( "getGitVersion returns undefined when version cannot be determined" , async ( t ) => {
494- gitUtils . resetCachedGitVersion ( ) ;
495- const runGitCommandStub = sinon
496- . stub ( gitUtils as any , "runGitCommand" )
497- . rejects ( new Error ( "git not found" ) ) ;
498-
499- const messages :LoggedMessage [ ] = [ ] ;
500- const logger = getRecordingLogger ( messages ) ;
501-
502- try {
503- const version = await gitUtils . getGitVersion ( logger ) ;
504- t . is ( version , undefined ) ;
505- t . true (
506- messages . some (
507- ( m ) =>
508- m . type === "debug" &&
509- typeof m . message === "string" &&
510- m . message . includes ( "Could not determine Git version" ) ,
511- ) ,
512- ) ;
513- } finally {
514- runGitCommandStub . restore ( ) ;
515- gitUtils . resetCachedGitVersion ( ) ;
516- }
517- } ) ;
518-
519468test ( "gitVersionAtLeast returns true for version meeting requirement" , async ( t ) => {
520- gitUtils . resetCachedGitVersion ( ) ;
521469const runGitCommandStub = sinon
522470. stub ( gitUtils as any , "runGitCommand" )
523471. resolves ( "git version 2.40.0\n" ) ;
@@ -537,12 +485,10 @@ test("gitVersionAtLeast returns true for version meeting requirement", async (t)
537485) ;
538486} finally {
539487runGitCommandStub . restore ( ) ;
540- gitUtils . resetCachedGitVersion ( ) ;
541488}
542489} ) ;
543490
544491test ( "gitVersionAtLeast returns false for version not meeting requirement" , async ( t ) => {
545- gitUtils . resetCachedGitVersion ( ) ;
546492const runGitCommandStub = sinon
547493. stub ( gitUtils as any , "runGitCommand" )
548494. resolves ( "git version 2.30.0\n" ) ;
@@ -555,12 +501,10 @@ test("gitVersionAtLeast returns false for version not meeting requirement", asyn
555501t . false ( result ) ;
556502} finally {
557503runGitCommandStub . restore ( ) ;
558- gitUtils . resetCachedGitVersion ( ) ;
559504}
560505} ) ;
561506
562507test ( "gitVersionAtLeast returns false when version cannot be determined" , async ( t ) => {
563- gitUtils . resetCachedGitVersion ( ) ;
564508const runGitCommandStub = sinon
565509. stub ( gitUtils as any , "runGitCommand" )
566510. rejects ( new Error ( "git not found" ) ) ;
@@ -581,6 +525,5 @@ test("gitVersionAtLeast returns false when version cannot be determined", async
581525) ;
582526} finally {
583527runGitCommandStub . restore ( ) ;
584- gitUtils . resetCachedGitVersion ( ) ;
585528}
586529} ) ;