@@ -141,6 +141,19 @@ describe('preBuild()', () => {
141
141
} ) ,
142
142
) . rejects . toThrow ( `Could not find a package.json for this project` )
143
143
} )
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
+ } )
144
157
} )
145
158
146
159
describe ( 'onBuild()' , ( ) => {
@@ -155,6 +168,7 @@ describe('onBuild()', () => {
155
168
netlifyConfig,
156
169
packageJson,
157
170
constants : { } ,
171
+ utils,
158
172
} )
159
173
160
174
expect ( await pathExists ( `${ PUBLISH_DIR } /index.html` ) ) . toBeFalsy ( )
@@ -170,6 +184,7 @@ describe('onBuild()', () => {
170
184
packageJson : DUMMY_PACKAGE_JSON ,
171
185
utils,
172
186
constants : { FUNCTIONS_SRC : 'out_functions' } ,
187
+ utils,
173
188
} )
174
189
175
190
expect ( await pathExists ( `${ PUBLISH_DIR } /index.html` ) ) . toBeFalsy ( )
@@ -187,6 +202,7 @@ describe('onBuild()', () => {
187
202
PUBLISH_DIR ,
188
203
FUNCTIONS_SRC : 'functions' ,
189
204
} ,
205
+ utils,
190
206
} )
191
207
192
208
expect ( await pathExists ( `${ PUBLISH_DIR } /_redirects` ) ) . toBeTruthy ( )
@@ -206,6 +222,7 @@ describe('onBuild()', () => {
206
222
FUNCTIONS_SRC ,
207
223
PUBLISH_DIR : '.' ,
208
224
} ,
225
+ utils,
209
226
} )
210
227
211
228
expect ( await pathExists ( `${ resolvedFunctions } /next_api_test/next_api_test.js` ) ) . toBeTruthy ( )
0 commit comments