@@ -919,7 +919,7 @@ describe('Config', () => {
919919 }
920920 } )
921921
922- expect ( log . error ) . to . be . calledThrice
922+ expect ( log . error ) . to . be . callCount ( 4 )
923923 expect ( log . error . firstCall ) . to . have . been . calledWithExactly ( error )
924924 expect ( log . error . secondCall ) . to . have . been . calledWithExactly ( error )
925925 expect ( log . error . thirdCall ) . to . have . been . calledWithExactly ( error )
@@ -1071,6 +1071,7 @@ describe('Config', () => {
10711071 delete process . env . DD_GIT_PROPERTIES_FILE
10721072 delete process . env . DD_GIT_COMMIT_SHA
10731073 delete process . env . DD_GIT_REPOSITORY_URL
1074+ delete process . env . DD_TRACE_GIT_METADATA_ENABLED
10741075 process . env . DD_TAGS = ddTags
10751076 } )
10761077 it ( 'reads DD_GIT_* env vars' , ( ) => {
@@ -1120,5 +1121,11 @@ describe('Config', () => {
11201121 expect ( config ) . to . have . property ( 'commitSHA' , '4e7da8069bcf5ffc8023603b95653e2dc99d1c7d' )
11211122 expect ( config ) . to . have . property ( 'repositoryUrl' , 'https://github.com/datadog/dd-trace-js' )
11221123 } )
1124+ it ( 'does not read git metadata if DD_TRACE_GIT_METADATA_ENABLED is false' , ( ) => {
1125+ process . env . DD_TRACE_GIT_METADATA_ENABLED = 'false'
1126+ const config = new Config ( { } )
1127+ expect ( config ) . not . to . have . property ( 'commitSHA' )
1128+ expect ( config ) . not . to . have . property ( 'repositoryUrl' )
1129+ } )
11231130 } )
11241131} )
0 commit comments