@@ -141,6 +141,19 @@ describe('preBuild()', () => {
141141 } ) ,
142142 ) . rejects . toThrow ( `Could not find a package.json for this project` )
143143 } )
144+
145+ test ( 'fail build if the app cant load the next.config.js' , async ( ) => {
146+ await useFixture ( 'broken_next_config' )
147+
148+ await expect (
149+ plugin . onPreBuild ( {
150+ netlifyConfig,
151+ packageJson : DUMMY_PACKAGE_JSON ,
152+ utils,
153+ constants : { FUNCTIONS_SRC : 'out_functions' } ,
154+ } ) ,
155+ ) . rejects . toThrow ( `Error loading your next.config.js.` )
156+ } )
144157} )
145158
146159describe ( 'onBuild()' , ( ) => {
@@ -155,6 +168,7 @@ describe('onBuild()', () => {
155168 netlifyConfig,
156169 packageJson,
157170 constants : { } ,
171+ utils,
158172 } )
159173
160174 expect ( await pathExists ( `${ PUBLISH_DIR } /index.html` ) ) . toBeFalsy ( )
@@ -170,6 +184,7 @@ describe('onBuild()', () => {
170184 packageJson : DUMMY_PACKAGE_JSON ,
171185 utils,
172186 constants : { FUNCTIONS_SRC : 'out_functions' } ,
187+ utils,
173188 } )
174189
175190 expect ( await pathExists ( `${ PUBLISH_DIR } /index.html` ) ) . toBeFalsy ( )
@@ -187,6 +202,7 @@ describe('onBuild()', () => {
187202 PUBLISH_DIR ,
188203 FUNCTIONS_SRC : 'functions' ,
189204 } ,
205+ utils,
190206 } )
191207
192208 expect ( await pathExists ( `${ PUBLISH_DIR } /_redirects` ) ) . toBeTruthy ( )
@@ -206,6 +222,7 @@ describe('onBuild()', () => {
206222 FUNCTIONS_SRC ,
207223 PUBLISH_DIR : '.' ,
208224 } ,
225+ utils,
209226 } )
210227
211228 expect ( await pathExists ( `${ resolvedFunctions } /next_api_test/next_api_test.js` ) ) . toBeTruthy ( )
0 commit comments