@@ -258,7 +258,7 @@ describe(validateConfig, () => {
258258
259259 expect ( ( ) => {
260260 validateConfig ( BuildConfigSchema , buildConfig ) ;
261- } ) . toThrowError ( / " b u i l d .s t e p s \[ 0 \] .r u n .e n v .E N V 1 " m u s t b e a s t r i n g / ) ;
261+ } ) . toThrowError ( / " b u i l d .s t e p s \[ 0 \] .r u n .e n v .E N V 1 " m u s t b e o n e o f \[ n u m b e r , s t r i n g \] / ) ;
262262 } ) ;
263263 test ( 'invalid env type' , ( ) => {
264264 const buildConfig = {
@@ -278,7 +278,27 @@ describe(validateConfig, () => {
278278
279279 expect ( ( ) => {
280280 validateConfig ( BuildConfigSchema , buildConfig ) ;
281- } ) . toThrowError ( / " b u i l d .s t e p s \[ 0 \] .r u n .e n v .E N V 1 " m u s t b e a s t r i n g / ) ;
281+ } ) . toThrowError ( / " b u i l d .s t e p s \[ 0 \] .r u n .e n v .E N V 1 " m u s t b e o n e o f \[ n u m b e r , s t r i n g \] / ) ;
282+ } ) ;
283+ test ( 'env number coerced to string' , ( ) => {
284+ const buildConfig = {
285+ build : {
286+ steps : [
287+ {
288+ run : {
289+ command : 'echo 123' ,
290+ env : {
291+ HOMEBREW_NO_AUTO_UPDATE : 1 ,
292+ } ,
293+ } ,
294+ } ,
295+ ] ,
296+ } ,
297+ } ;
298+
299+ const config = validateConfig ( BuildConfigSchema , buildConfig ) ;
300+ assert ( isBuildStepCommandRun ( config . build . steps [ 0 ] ) ) ;
301+ expect ( config . build . steps [ 0 ] . run . env ) . toEqual ( { HOMEBREW_NO_AUTO_UPDATE : '1' } ) ;
282302 } ) ;
283303 test ( 'valid timeout_minutes' , ( ) => {
284304 const buildConfig = {
@@ -471,6 +491,36 @@ describe(validateConfig, () => {
471491 validateConfig ( BuildConfigSchema , buildConfig ) ;
472492 } ) . not . toThrowError ( ) ;
473493 } ) ;
494+ test ( 'call with env number coerced to string' , ( ) => {
495+ const buildConfig = {
496+ build : {
497+ steps : [
498+ {
499+ say_hi : {
500+ env : {
501+ HOMEBREW_NO_AUTO_UPDATE : 1 ,
502+ PORT : 3000 ,
503+ VERBOSE : 'true' ,
504+ } ,
505+ } ,
506+ } ,
507+ ] ,
508+ } ,
509+ functions : {
510+ say_hi : {
511+ command : 'echo "Hi!"' ,
512+ } ,
513+ } ,
514+ } ;
515+
516+ const config = validateConfig ( BuildConfigSchema , buildConfig ) ;
517+ const step = config . build . steps [ 0 ] as BuildStepFunctionCall ;
518+ expect ( step [ 'say_hi' ] . env ) . toEqual ( {
519+ HOMEBREW_NO_AUTO_UPDATE : '1' ,
520+ PORT : '3000' ,
521+ VERBOSE : 'true' ,
522+ } ) ;
523+ } ) ;
474524 test ( 'call with if statement' , ( ) => {
475525 const buildConfig = {
476526 build : {
@@ -518,7 +568,7 @@ describe(validateConfig, () => {
518568
519569 expect ( ( ) => {
520570 validateConfig ( BuildConfigSchema , buildConfig ) ;
521- } ) . toThrowError ( / " b u i l d .s t e p s \[ 0 \] .s a y _ h i .e n v .E N V 1 " m u s t b e a s t r i n g / ) ;
571+ } ) . toThrowError ( / " b u i l d .s t e p s \[ 0 \] .s a y _ h i .e n v .E N V 1 " m u s t b e o n e o f \[ n u m b e r , s t r i n g \] / ) ;
522572 } ) ;
523573 test ( 'invalid env structure' , ( ) => {
524574 const buildConfig = {
@@ -544,7 +594,7 @@ describe(validateConfig, () => {
544594
545595 expect ( ( ) => {
546596 validateConfig ( BuildConfigSchema , buildConfig ) ;
547- } ) . toThrowError ( / " b u i l d .s t e p s \[ 0 \] .s a y _ h i .e n v .E N V 1 " m u s t b e a s t r i n g / ) ;
597+ } ) . toThrowError ( / " b u i l d .s t e p s \[ 0 \] .s a y _ h i .e n v .E N V 1 " m u s t b e o n e o f \[ n u m b e r , s t r i n g \] / ) ;
548598 } ) ;
549599 test ( 'call with inputs boolean' , ( ) => {
550600 const buildConfig = {
0 commit comments