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 = {
11
11
return BbPromise . resolve ( ) ;
12
12
}
13
13
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 ) ;
15
16
return this . serverless . yamlParser
16
17
. parse ( serverlessYmlPath )
17
18
. then ( serverlessFileParam => this . serverless . variables . populateObject ( serverlessFileParam )
Original file line number Diff line number Diff line change @@ -133,6 +133,27 @@ describe('#yamlParse', () => {
133
133
expect ( serverless . service . stepFunctions . activities ) . to . be . deep . equal ( [ ] ) ;
134
134
} ) ;
135
135
} ) ;
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
+ } ) ;
136
157
} ) ;
137
158
138
159
describe ( '#getAllStateMachines()' , ( ) => {
You can’t perform that action at this time.
0 commit comments