@@ -27,7 +27,7 @@ describe('Configure AWS Credentials helpers', {}, () => {
2727 vi . spyOn ( core , 'setOutput' ) . mockImplementation ( ( ) => { } ) ;
2828 vi . spyOn ( core , 'setSecret' ) . mockImplementation ( ( ) => { } ) ;
2929 vi . spyOn ( core , 'exportVariable' ) . mockImplementation ( ( ) => { } ) ;
30- helpers . exportCredentials ( { AccessKeyId : 'test' , SecretAccessKey : 'test' , SessionToken : 'test' , Expiration : new Date ( 8640000000000000 ) } , true ) ;
30+ helpers . exportCredentials ( { AccessKeyId : 'test' , SecretAccessKey : 'test' , SessionToken : 'test' , Expiration : new Date ( 8640000000000000 ) } , true , true ) ;
3131 expect ( core . setOutput ) . toHaveBeenCalledTimes ( 4 ) ;
3232 expect ( core . setSecret ) . toHaveBeenCalledTimes ( 3 ) ;
3333 expect ( core . exportVariable ) . toHaveBeenCalledTimes ( 3 ) ;
@@ -42,4 +42,15 @@ describe('Configure AWS Credentials helpers', {}, () => {
4242 expect ( process . env . AWS_DEFAULT_REGION ) . toBeUndefined ;
4343 process . env = env ;
4444 } ) ;
45+ it ( `won't output credentials to env if told not to` , { } , ( ) => {
46+ vi . spyOn ( core , 'setOutput' ) . mockImplementation ( ( ) => { } ) ;
47+ vi . spyOn ( core , 'setSecret' ) . mockImplementation ( ( ) => { } ) ;
48+ vi . spyOn ( core , 'exportVariable' ) . mockImplementation ( ( ) => { } ) ;
49+ helpers . exportCredentials ( { AccessKeyId : 'test' , SecretAccessKey : 'test' , SessionToken : 'test' , Expiration : new Date ( 8640000000000000 ) } , true , false ) ;
50+ helpers . unsetCredentials ( false ) ;
51+ helpers . exportRegion ( 'fake-test-region' , false ) ;
52+ expect ( core . setOutput ) . toHaveBeenCalledTimes ( 4 ) ;
53+ expect ( core . setSecret ) . toHaveBeenCalledTimes ( 3 ) ;
54+ expect ( core . exportVariable ) . toHaveBeenCalledTimes ( 0 ) ;
55+ } ) ;
4556} ) ;
0 commit comments