This repository was archived by the owner on Dec 9, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -78,16 +78,18 @@ describe("Login Plugin", () => {
78
78
expect ( sls . variables [ "subscriptionId" ] ) . toEqual ( "azureSubId" ) ;
79
79
} ) ;
80
80
81
- it ( "logs an error from authentication" , async ( ) => {
81
+ it ( "logs an error from authentication and exits process " , async ( ) => {
82
82
unsetServicePrincipalEnvVariables ( ) ;
83
+ process . exit = jest . fn ( ) as any ;
83
84
const errorMessage = "This is my error message" ;
84
85
AzureLoginService . interactiveLogin = jest . fn ( ( ) => {
85
86
throw new Error ( errorMessage ) ;
86
- } ) ;
87
+ } ) ;
87
88
const sls = MockFactory . createTestServerless ( ) ;
88
89
await invokeLoginHook ( false , sls ) ;
89
90
expect ( AzureLoginService . interactiveLogin ) . toBeCalled ( )
90
91
expect ( AzureLoginService . servicePrincipalLogin ) . not . toBeCalled ( ) ;
91
- expect ( sls . cli . log ) . lastCalledWith ( `Error: ${ errorMessage } ` )
92
+ expect ( sls . cli . log ) . lastCalledWith ( `Error: ${ errorMessage } ` ) ;
93
+ expect ( process . exit ) . toBeCalledWith ( 0 ) ;
92
94
} ) ;
93
- } )
95
+ } ) ;
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ export class AzureLoginPlugin {
35
35
catch ( e ) {
36
36
this . serverless . cli . log ( "Error logging into azure" ) ;
37
37
this . serverless . cli . log ( `${ e } ` ) ;
38
+ process . exit ( 0 ) ;
38
39
}
39
40
}
40
41
}
You can’t perform that action at this time.
0 commit comments