@@ -150,7 +150,7 @@ testMatrix.forEach(({ args }) => {
150150
151151 test ( testName ( 'should return response from a function with setTimeout' , args ) , async ( t ) => {
152152 await withSiteBuilder ( 'site-with-set-timeout-function' , async ( builder ) => {
153- builder . withNetlifyToml ( { config : { build : { functions : 'functions' } } } ) . withFunction ( {
153+ builder . withNetlifyToml ( { config : { functions : { directory : 'functions' } } } ) . withFunction ( {
154154 path : 'timeout.js' ,
155155 handler : async ( ) => {
156156 console . log ( 'ding' )
@@ -177,7 +177,7 @@ testMatrix.forEach(({ args }) => {
177177
178178 test ( testName ( 'should serve function from a subdirectory' , args ) , async ( t ) => {
179179 await withSiteBuilder ( 'site-with-from-subdirectory' , async ( builder ) => {
180- builder . withNetlifyToml ( { config : { build : { functions : 'functions' } } } ) . withFunction ( {
180+ builder . withNetlifyToml ( { config : { functions : { directory : 'functions' } } } ) . withFunction ( {
181181 path : path . join ( 'echo' , 'echo.js' ) ,
182182 handler : async ( ) => ( {
183183 statusCode : 200 ,
@@ -197,7 +197,7 @@ testMatrix.forEach(({ args }) => {
197197 test ( testName ( 'should pass .env.development vars to function' , args ) , async ( t ) => {
198198 await withSiteBuilder ( 'site-with-env-development' , async ( builder ) => {
199199 builder
200- . withNetlifyToml ( { config : { build : { functions : 'functions' } } } )
200+ . withNetlifyToml ( { config : { functions : { directory : 'functions' } } } )
201201 . withEnvFile ( { path : '.env.development' , env : { TEST : 'FROM_DEV_FILE' } } )
202202 . withFunction ( {
203203 path : 'env.js' ,
@@ -218,7 +218,7 @@ testMatrix.forEach(({ args }) => {
218218
219219 test ( testName ( 'should pass process env vars to function' , args ) , async ( t ) => {
220220 await withSiteBuilder ( 'site-with-process-env' , async ( builder ) => {
221- builder . withNetlifyToml ( { config : { build : { functions : 'functions' } } } ) . withFunction ( {
221+ builder . withNetlifyToml ( { config : { functions : { directory : 'functions' } } } ) . withFunction ( {
222222 path : 'env.js' ,
223223 handler : async ( ) => ( {
224224 statusCode : 200 ,
@@ -238,7 +238,9 @@ testMatrix.forEach(({ args }) => {
238238 test ( testName ( 'should pass [build.environment] env vars to function' , args ) , async ( t ) => {
239239 await withSiteBuilder ( 'site-with-build-environment' , async ( builder ) => {
240240 builder
241- . withNetlifyToml ( { config : { build : { environment : { TEST : 'FROM_CONFIG_FILE' } , functions : 'functions' } } } )
241+ . withNetlifyToml ( {
242+ config : { build : { environment : { TEST : 'FROM_CONFIG_FILE' } } , functions : { directory : 'functions' } } ,
243+ } )
242244 . withFunction ( {
243245 path : 'env.js' ,
244246 handler : async ( ) => ( {
@@ -261,8 +263,9 @@ testMatrix.forEach(({ args }) => {
261263 builder
262264 . withNetlifyToml ( {
263265 config : {
264- build : { environment : { TEST : 'DEFAULT_CONTEXT' } , functions : 'functions' } ,
266+ build : { environment : { TEST : 'DEFAULT_CONTEXT' } } ,
265267 context : { dev : { environment : { TEST : 'DEV_CONTEXT' } } } ,
268+ functions : { directory : 'functions' } ,
266269 } ,
267270 } )
268271 . withFunction ( {
@@ -287,8 +290,9 @@ testMatrix.forEach(({ args }) => {
287290 builder
288291 . withNetlifyToml ( {
289292 config : {
290- build : { environment : { TEST : 'DEFAULT_CONTEXT' } , functions : 'functions' } ,
293+ build : { environment : { TEST : 'DEFAULT_CONTEXT' } } ,
291294 context : { production : { environment : { TEST : 'PRODUCTION_CONTEXT' } } } ,
295+ functions : { directory : 'functions' } ,
292296 } ,
293297 } )
294298 . withFunction ( {
@@ -311,7 +315,7 @@ testMatrix.forEach(({ args }) => {
311315 test ( testName ( 'should override .env.development with process env' , args ) , async ( t ) => {
312316 await withSiteBuilder ( 'site-with-override' , async ( builder ) => {
313317 builder
314- . withNetlifyToml ( { config : { build : { functions : 'functions' } } } )
318+ . withNetlifyToml ( { config : { functions : { directory : 'functions' } } } )
315319 . withEnvFile ( { path : '.env.development' , env : { TEST : 'FROM_DEV_FILE' } } )
316320 . withFunction ( {
317321 path : 'env.js' ,
@@ -333,7 +337,9 @@ testMatrix.forEach(({ args }) => {
333337 test ( testName ( 'should override [build.environment] with process env' , args ) , async ( t ) => {
334338 await withSiteBuilder ( 'site-with-build-environment-override' , async ( builder ) => {
335339 builder
336- . withNetlifyToml ( { config : { build : { environment : { TEST : 'FROM_CONFIG_FILE' } , functions : 'functions' } } } )
340+ . withNetlifyToml ( {
341+ config : { build : { environment : { TEST : 'FROM_CONFIG_FILE' } } , functions : { directory : 'functions' } } ,
342+ } )
337343 . withFunction ( {
338344 path : 'env.js' ,
339345 handler : async ( ) => ( {
@@ -353,7 +359,7 @@ testMatrix.forEach(({ args }) => {
353359
354360 test ( testName ( 'should override value of the NETLIFY_DEV env variable' , args ) , async ( t ) => {
355361 await withSiteBuilder ( 'site-with-netlify-dev-override' , async ( builder ) => {
356- builder . withNetlifyToml ( { config : { build : { functions : 'functions' } } } ) . withFunction ( {
362+ builder . withNetlifyToml ( { config : { functions : { directory : 'functions' } } } ) . withFunction ( {
357363 path : 'env.js' ,
358364 handler : async ( ) => ( {
359365 statusCode : 200 ,
@@ -375,7 +381,7 @@ testMatrix.forEach(({ args }) => {
375381
376382 test ( testName ( 'should set value of the CONTEXT env variable' , args ) , async ( t ) => {
377383 await withSiteBuilder ( 'site-with-context-override' , async ( builder ) => {
378- builder . withNetlifyToml ( { config : { build : { functions : 'functions' } } } ) . withFunction ( {
384+ builder . withNetlifyToml ( { config : { functions : { directory : 'functions' } } } ) . withFunction ( {
379385 path : 'env.js' ,
380386 handler : async ( ) => ( {
381387 statusCode : 200 ,
@@ -397,7 +403,7 @@ testMatrix.forEach(({ args }) => {
397403 builder
398404 . withNetlifyToml ( {
399405 config : {
400- build : { functions : 'functions' } ,
406+ functions : { directory : 'functions' } ,
401407 redirects : [ { from : '/api/*' , to : '/.netlify/functions/:splat' , status : 200 } ] ,
402408 } ,
403409 } )
@@ -423,7 +429,7 @@ testMatrix.forEach(({ args }) => {
423429 builder
424430 . withNetlifyToml ( {
425431 config : {
426- build : { functions : 'functions' } ,
432+ functions : { directory : 'functions' } ,
427433 redirects : [ { from : '/api/*' , to : '/.netlify/functions/:splat' , status : 200 } ] ,
428434 } ,
429435 } )
@@ -454,7 +460,7 @@ testMatrix.forEach(({ args }) => {
454460 builder
455461 . withNetlifyToml ( {
456462 config : {
457- build : { functions : 'functions' } ,
463+ functions : { directory : 'functions' } ,
458464 redirects : [ { from : '/api/*' , to : '/.netlify/functions/:splat' , status : 200 } ] ,
459465 } ,
460466 } )
@@ -495,7 +501,7 @@ testMatrix.forEach(({ args }) => {
495501 builder
496502 . withNetlifyToml ( {
497503 config : {
498- build : { functions : 'functions' } ,
504+ functions : { directory : 'functions' } ,
499505 redirects : [ { from : '/api/*' , to : '/.netlify/functions/:splat' , status : 200 } ] ,
500506 } ,
501507 } )
@@ -527,7 +533,7 @@ testMatrix.forEach(({ args }) => {
527533 builder
528534 . withNetlifyToml ( {
529535 config : {
530- build : { functions : 'functions' } ,
536+ functions : { directory : 'functions' } ,
531537 redirects : [ { from : '/api/*' , to : '/.netlify/functions/:splat' , status : 200 } ] ,
532538 } ,
533539 } )
@@ -570,7 +576,7 @@ testMatrix.forEach(({ args }) => {
570576 await withSiteBuilder ( 'site-with-missing-function' , async ( builder ) => {
571577 builder . withNetlifyToml ( {
572578 config : {
573- build : { functions : 'functions' } ,
579+ functions : { directory : 'functions' } ,
574580 redirects : [ { from : '/api/*' , to : '/.netlify/functions/:splat' , status : 200 } ] ,
575581 } ,
576582 } )
@@ -594,7 +600,7 @@ testMatrix.forEach(({ args }) => {
594600 builder
595601 . withNetlifyToml ( {
596602 config : {
597- build : { functions : 'functions' } ,
603+ functions : { directory : 'functions' } ,
598604 } ,
599605 } )
600606 . withFunction ( {
@@ -626,7 +632,7 @@ testMatrix.forEach(({ args }) => {
626632 } )
627633 . withNetlifyToml ( {
628634 config : {
629- build : { functions : 'functions' } ,
635+ functions : { directory : 'functions' } ,
630636 } ,
631637 } )
632638 . withFunction ( {
@@ -691,7 +697,7 @@ testMatrix.forEach(({ args }) => {
691697 } )
692698 . withNetlifyToml ( {
693699 config : {
694- build : { functions : 'functions' } ,
700+ functions : { directory : 'functions' } ,
695701 } ,
696702 } )
697703 . withFunction ( {
@@ -1036,7 +1042,7 @@ testMatrix.forEach(({ args }) => {
10361042 await withSiteBuilder ( 'site-with-post-no-content-type' , async ( builder ) => {
10371043 builder . withNetlifyToml ( {
10381044 config : {
1039- build : { functions : 'functions' } ,
1045+ functions : { directory : 'functions' } ,
10401046 redirects : [ { from : '/api/*' , to : '/other/:splat' , status : 200 } ] ,
10411047 } ,
10421048 } )
@@ -1164,7 +1170,7 @@ testMatrix.forEach(({ args }) => {
11641170
11651171 test ( testName ( 'should return 202 ok and empty response for background function' , args ) , async ( t ) => {
11661172 await withSiteBuilder ( 'site-with-background-function' , async ( builder ) => {
1167- builder . withNetlifyToml ( { config : { build : { functions : 'functions' } } } ) . withFunction ( {
1173+ builder . withNetlifyToml ( { config : { functions : { directory : 'functions' } } } ) . withFunction ( {
11681174 path : 'hello-background.js' ,
11691175 handler : ( ) => {
11701176 console . log ( "Look at me I'm a background task" )
@@ -1379,7 +1385,7 @@ testMatrix.forEach(({ args }) => {
13791385 await withSiteBuilder ( 'site-with-functions' , async ( builder ) => {
13801386 const functionsPort = 6666
13811387 await builder
1382- . withNetlifyToml ( { config : { build : { functions : 'functions' } , dev : { functionsPort } } } )
1388+ . withNetlifyToml ( { config : { functions : { directory : 'functions' } , dev : { functionsPort } } } )
13831389 . buildAsync ( )
13841390
13851391 await withDevServer ( { cwd : builder . directory , args } , async ( { url, port } ) => {
@@ -1405,7 +1411,8 @@ testMatrix.forEach(({ args }) => {
14051411 } )
14061412 . withNetlifyToml ( {
14071413 config : {
1408- build : { functions : 'functions' , publish : 'public' } ,
1414+ build : { publish : 'public' } ,
1415+ functions : { directory : 'functions' } ,
14091416 } ,
14101417 } )
14111418 . withRedirectsFile ( {
0 commit comments