@@ -14,6 +14,7 @@ const packageName = "@scope/some-package";
1414const pkg = { name : packageName } ;
1515const idToken = "id-token-value" ;
1616const token = "token-value" ;
17+ const logger = { log : ( ) => undefined } ;
1718
1819test . beforeEach ( async ( t ) => {
1920 await td . replace ( globalThis , "fetch" ) ;
@@ -41,7 +42,7 @@ test.serial("that an access token is returned when token exchange succeeds on Gi
4142 new Response ( JSON . stringify ( { token } ) , { status : 201 , headers : { "Content-Type" : "application/json" } } )
4243 ) ;
4344
44- t . is ( await exchangeToken ( pkg ) , token ) ;
45+ t . is ( await exchangeToken ( pkg , { logger } ) , token ) ;
4546} ) ;
4647
4748test . serial ( "that `undefined` is returned when ID token retrieval fails on GitHub Actions" , async ( t ) => {
@@ -50,7 +51,7 @@ test.serial("that `undefined` is returned when ID token retrieval fails on GitHu
5051 new Error ( "Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable" )
5152 ) ;
5253
53- t . is ( await exchangeToken ( pkg ) , undefined ) ;
54+ t . is ( await exchangeToken ( pkg , { logger } ) , undefined ) ;
5455} ) ;
5556
5657test . serial ( "that `undefined` is returned when token exchange fails on GitHub Actions" , async ( t ) => {
@@ -65,7 +66,7 @@ test.serial("that `undefined` is returned when token exchange fails on GitHub Ac
6566 new Response ( JSON . stringify ( { message : "foo" } ) , { status : 401 , headers : { "Content-Type" : "application/json" } } )
6667 ) ;
6768
68- t . is ( await exchangeToken ( pkg ) , undefined ) ;
69+ t . is ( await exchangeToken ( pkg , { logger } ) , undefined ) ;
6970} ) ;
7071
7172test . serial ( "that an access token is returned when token exchange succeeds on GitLab Pipelines" , async ( t ) => {
@@ -80,13 +81,13 @@ test.serial("that an access token is returned when token exchange succeeds on Gi
8081 new Response ( JSON . stringify ( { token } ) , { status : 201 , headers : { "Content-Type" : "application/json" } } )
8182 ) ;
8283
83- t . is ( await exchangeToken ( pkg ) , token ) ;
84+ t . is ( await exchangeToken ( pkg , { logger } ) , token ) ;
8485} ) ;
8586
8687test . serial ( "that `undefined` is returned when ID token is not available on GitLab Pipelines" , async ( t ) => {
8788 td . when ( envCi ( ) ) . thenReturn ( { name : GITLAB_PIPELINES_PROVIDER_NAME } ) ;
8889
89- t . is ( await exchangeToken ( pkg ) , undefined ) ;
90+ t . is ( await exchangeToken ( pkg , { logger } ) , undefined ) ;
9091} ) ;
9192
9293test . serial ( "that `undefined` is returned when token exchange fails on GitLab Pipelines" , async ( t ) => {
@@ -101,11 +102,11 @@ test.serial("that `undefined` is returned when token exchange fails on GitLab Pi
101102 new Response ( JSON . stringify ( { message : "foo" } ) , { status : 401 , headers : { "Content-Type" : "application/json" } } )
102103 ) ;
103104
104- t . is ( await exchangeToken ( pkg ) , undefined ) ;
105+ t . is ( await exchangeToken ( pkg , { logger } ) , undefined ) ;
105106} ) ;
106107
107108test . serial ( "that `undefined` is returned when no supported CI provider is detected" , async ( t ) => {
108109 td . when ( envCi ( ) ) . thenReturn ( { name : "Other Service" } ) ;
109110
110- t . is ( await exchangeToken ( pkg ) , undefined ) ;
111+ t . is ( await exchangeToken ( pkg , { logger } ) , undefined ) ;
111112} ) ;
0 commit comments