File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,11 @@ const path = require('path');
1212function validateClient ( serverless , options ) {
1313 const validationErrors = [ ] ;
1414
15+ if ( ! is . object ( options ) ) {
16+ validationErrors . push ( 'Options must be an object defined under `custom.client`' ) ;
17+ throw validationErrors ;
18+ }
19+
1520 // path to website files must exist
1621 const distributionFolder = options . distributionFolder || path . join ( 'client/dist' ) ;
1722 const clientPath = path . join ( serverless . config . servicePath , distributionFolder ) ;
Original file line number Diff line number Diff line change @@ -28,6 +28,16 @@ describe('validate', () => {
2828 expect ( ( ) => validate ( sls , { bucketName : 'my-bucket' } ) ) . not . to . throw ( ) ;
2929 } ) ;
3030
31+ it ( 'throws if options are undefined' , ( ) => {
32+ const sls = {
33+ config : { servicePath : 'foo' } ,
34+ utils : { dirExistsSync : ( ) => true }
35+ } ;
36+ expect ( ( ) => validate ( sls , undefined ) )
37+ . to . throw ( )
38+ . contains ( 'Options must be an object defined under `custom.client`' ) ;
39+ } ) ;
40+
3141 it ( 'throws if serverless.utils.dirExistsSync returns false' , ( ) => {
3242 const sls = {
3343 config : { servicePath : 'foo' } ,
You can’t perform that action at this time.
0 commit comments