File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,8 @@ module.exports = {
1111 return BbPromise . resolve ( ) ;
1212 }
1313
14- const serverlessYmlPath = path . join ( servicePath , 'serverless.yml' ) ;
14+ const serviceFileName = this . serverless . config . serverless . service . serviceFilename || 'serverless.yml' ;
15+ const serverlessYmlPath = path . join ( servicePath , serviceFileName ) ;
1516 return this . serverless . yamlParser
1617 . parse ( serverlessYmlPath )
1718 . then ( serverlessFileParam => this . serverless . variables . populateObject ( serverlessFileParam )
Original file line number Diff line number Diff line change @@ -133,6 +133,27 @@ describe('#yamlParse', () => {
133133 expect ( serverless . service . stepFunctions . activities ) . to . be . deep . equal ( [ ] ) ;
134134 } ) ;
135135 } ) ;
136+
137+ it ( 'should default to serverless.yml if serviceFileName (--config option) is not passed' , ( ) => {
138+ const servicePath = serverlessStepFunctions . serverless . config . servicePath ;
139+ serverlessStepFunctions . serverless . config . serverless . service . serviceFilename = undefined ;
140+
141+ serverlessStepFunctions . yamlParse ( )
142+ . then ( ( ) => {
143+ expect ( yamlParserStub . calledWith ( `${ servicePath } /serverless.yml` ) ) . to . be . equal ( true ) ;
144+ } ) ;
145+ } ) ;
146+
147+ it ( 'should read serviceFileName if passed as --config option' , ( ) => {
148+ const servicePath = serverlessStepFunctions . serverless . config . servicePath ;
149+ const fileName = 'other_config.yml' ;
150+ serverlessStepFunctions . serverless . config . serverless . service . serviceFilename = fileName ;
151+
152+ serverlessStepFunctions . yamlParse ( )
153+ . then ( ( ) => {
154+ expect ( yamlParserStub . calledWith ( `${ servicePath } /${ fileName } ` ) ) . to . be . equal ( true ) ;
155+ } ) ;
156+ } ) ;
136157 } ) ;
137158
138159 describe ( '#getAllStateMachines()' , ( ) => {
You can’t perform that action at this time.
0 commit comments