File tree 2 files changed +23
-0
lines changed
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 6
6
7
7
.idea
8
8
/.nyc_output
9
+ .history
Original file line number Diff line number Diff line change @@ -242,6 +242,28 @@ describe('validate', () => {
242
242
} ) ;
243
243
} ) ;
244
244
245
+ it ( 'should load a async webpack config from file if `custom.webpack` is a string' , ( ) => {
246
+ const testConfig = 'testconfig' ;
247
+ const testServicePath = 'testpath' ;
248
+ const requiredPath = path . join ( testServicePath , testConfig ) ;
249
+ module . serverless . config . servicePath = testServicePath ;
250
+ module . serverless . service . custom . webpack = testConfig ;
251
+ serverless . utils . fileExistsSync = sinon . stub ( ) . returns ( true ) ;
252
+ const loadedConfig = {
253
+ entry : 'testentry' ,
254
+ } ;
255
+ const loadedConfigPromise = Promise . resolve ( loadedConfig ) ;
256
+ mockery . registerMock ( requiredPath , loadedConfigPromise ) ;
257
+ return module
258
+ . validate ( )
259
+ . then ( ( ) => {
260
+ expect ( serverless . utils . fileExistsSync ) . to . have . been . calledWith ( requiredPath ) ;
261
+ expect ( module . webpackConfig ) . to . eql ( loadedConfig ) ;
262
+ mockery . deregisterMock ( requiredPath ) ;
263
+ return null ;
264
+ } ) ;
265
+ } ) ;
266
+
245
267
it ( 'should throw if providing an invalid file' , ( ) => {
246
268
const testConfig = 'testconfig' ;
247
269
const testServicePath = 'testpath' ;
You can’t perform that action at this time.
0 commit comments