@@ -140,6 +140,7 @@ describe('getArgs', () => {
140140 // prettier-ignore
141141 test . each ( [
142142 [
143+ 0 ,
143144 '0.4.1' ,
144145 new Map < string , string > ( [
145146 [ 'context' , '.' ] ,
@@ -156,6 +157,7 @@ describe('getArgs', () => {
156157 ]
157158 ] ,
158159 [
160+ 1 ,
159161 '0.4.2' ,
160162 new Map < string , string > ( [
161163 [ 'build-args' , 'MY_ARG=val1,val2,val3\nARG=val' ] ,
@@ -174,6 +176,7 @@ describe('getArgs', () => {
174176 ]
175177 ] ,
176178 [
179+ 2 ,
177180 '0.4.2' ,
178181 new Map < string , string > ( [
179182 [ 'tags' , 'name/app:7.4, name/app:latest' ] ,
@@ -185,13 +188,14 @@ describe('getArgs', () => {
185188 [
186189 'buildx' ,
187190 'build' ,
191+ '--iidfile' , '/tmp/.docker-build-push-jest/iidfile' ,
188192 '--tag' , 'name/app:7.4' ,
189193 '--tag' , 'name/app:latest' ,
190- '--iidfile' , '/tmp/.docker-build-push-jest/iidfile' ,
191194 'https://github.com/docker/build-push-action.git#refs/heads/test-jest'
192195 ]
193196 ] ,
194197 [
198+ 3 ,
195199 '0.4.2' ,
196200 new Map < string , string > ( [
197201 [ 'context' , '.' ] ,
@@ -212,6 +216,7 @@ describe('getArgs', () => {
212216 ]
213217 ] ,
214218 [
219+ 4 ,
215220 '0.4.1' ,
216221 new Map < string , string > ( [
217222 [ 'context' , '.' ] ,
@@ -229,6 +234,7 @@ describe('getArgs', () => {
229234 ]
230235 ] ,
231236 [
237+ 5 ,
232238 '0.4.1' ,
233239 new Map < string , string > ( [
234240 [ 'context' , '.' ] ,
@@ -245,6 +251,7 @@ describe('getArgs', () => {
245251 ]
246252 ] ,
247253 [
254+ 6 ,
248255 '0.4.2' ,
249256 new Map < string , string > ( [
250257 [ 'context' , '.' ] ,
@@ -263,6 +270,7 @@ describe('getArgs', () => {
263270 ]
264271 ] ,
265272 [
273+ 7 ,
266274 '0.4.2' ,
267275 new Map < string , string > ( [
268276 [ 'github-token' , 'abcdefghijklmno0123456789' ] ,
@@ -281,6 +289,7 @@ describe('getArgs', () => {
281289 ]
282290 ] ,
283291 [
292+ 8 ,
284293 '0.4.2' ,
285294 new Map < string , string > ( [
286295 [ 'context' , 'https://github.com/docker/build-push-action.git#refs/heads/master' ] ,
@@ -297,16 +306,17 @@ describe('getArgs', () => {
297306 [
298307 'buildx' ,
299308 'build' ,
300- '--platform ' , 'linux/amd64,linux/arm64 ' ,
309+ '--file ' , './test/Dockerfile ' ,
301310 '--iidfile' , '/tmp/.docker-build-push-jest/iidfile' ,
311+ '--platform' , 'linux/amd64,linux/arm64' ,
302312 '--secret' , 'id=GIT_AUTH_TOKEN,src=/tmp/.docker-build-push-jest/.tmpname-jest' ,
303- '--file' , './test/Dockerfile' ,
304313 '--builder' , 'builder-git-context-2' ,
305314 '--push' ,
306315 'https://github.com/docker/build-push-action.git#refs/heads/master'
307316 ]
308317 ] ,
309318 [
319+ 9 ,
310320 '0.4.2' ,
311321 new Map < string , string > ( [
312322 [ 'context' , 'https://github.com/docker/build-push-action.git#refs/heads/master' ] ,
@@ -331,19 +341,20 @@ ccc"`],
331341 [
332342 'buildx' ,
333343 'build' ,
334- '--platform ' , 'linux/amd64,linux/arm64 ' ,
344+ '--file ' , './test/Dockerfile ' ,
335345 '--iidfile' , '/tmp/.docker-build-push-jest/iidfile' ,
346+ '--platform' , 'linux/amd64,linux/arm64' ,
336347 '--secret' , 'id=GIT_AUTH_TOKEN,src=/tmp/.docker-build-push-jest/.tmpname-jest' ,
337348 '--secret' , 'id=MYSECRET,src=/tmp/.docker-build-push-jest/.tmpname-jest' ,
338349 '--secret' , 'id=FOO,src=/tmp/.docker-build-push-jest/.tmpname-jest' ,
339350 '--secret' , 'id=EMPTYLINE,src=/tmp/.docker-build-push-jest/.tmpname-jest' ,
340- '--file' , './test/Dockerfile' ,
341351 '--builder' , 'builder-git-context-2' ,
342352 '--push' ,
343353 'https://github.com/docker/build-push-action.git#refs/heads/master'
344354 ]
345355 ] ,
346356 [
357+ 10 ,
347358 '0.4.2' ,
348359 new Map < string , string > ( [
349360 [ 'context' , 'https://github.com/docker/build-push-action.git#refs/heads/master' ] ,
@@ -368,19 +379,20 @@ ccc`],
368379 [
369380 'buildx' ,
370381 'build' ,
371- '--platform ' , 'linux/amd64,linux/arm64 ' ,
382+ '--file ' , './test/Dockerfile ' ,
372383 '--iidfile' , '/tmp/.docker-build-push-jest/iidfile' ,
384+ '--platform' , 'linux/amd64,linux/arm64' ,
373385 '--secret' , 'id=GIT_AUTH_TOKEN,src=/tmp/.docker-build-push-jest/.tmpname-jest' ,
374386 '--secret' , 'id=MYSECRET,src=/tmp/.docker-build-push-jest/.tmpname-jest' ,
375387 '--secret' , 'id=FOO,src=/tmp/.docker-build-push-jest/.tmpname-jest' ,
376388 '--secret' , 'id=EMPTYLINE,src=/tmp/.docker-build-push-jest/.tmpname-jest' ,
377- '--file' , './test/Dockerfile' ,
378389 '--builder' , 'builder-git-context-2' ,
379390 '--push' ,
380391 'https://github.com/docker/build-push-action.git#refs/heads/master'
381392 ]
382393 ] ,
383394 [
395+ 11 ,
384396 '0.5.1' ,
385397 new Map < string , string > ( [
386398 [ 'context' , 'https://github.com/docker/build-push-action.git#refs/heads/master' ] ,
@@ -397,16 +409,17 @@ ccc`],
397409 [
398410 'buildx' ,
399411 'build' ,
412+ '--file' , './test/Dockerfile' ,
400413 '--iidfile' , '/tmp/.docker-build-push-jest/iidfile' ,
401414 '--secret' , 'id=MY_SECRET,src=/tmp/.docker-build-push-jest/.tmpname-jest' ,
402- '--file' , './test/Dockerfile' ,
403415 '--builder' , 'builder-git-context-2' ,
404416 '--network' , 'host' ,
405417 '--push' ,
406418 'https://github.com/docker/build-push-action.git#refs/heads/master'
407419 ]
408420 ] ,
409421 [
422+ 12 ,
410423 '0.4.2' ,
411424 new Map < string , string > ( [
412425 [ 'context' , '.' ] ,
@@ -427,6 +440,7 @@ ccc`],
427440 ]
428441 ] ,
429442 [
443+ 13 ,
430444 '0.6.0' ,
431445 new Map < string , string > ( [
432446 [ 'context' , '.' ] ,
@@ -441,25 +455,23 @@ ccc`],
441455 [
442456 'buildx' ,
443457 'build' ,
458+ '--file' , './test/Dockerfile' ,
444459 '--iidfile' , '/tmp/.docker-build-push-jest/iidfile' ,
445460 '--metadata-file' , '/tmp/.docker-build-push-jest/metadata-file' ,
446- '--file' , './test/Dockerfile' ,
447461 '--network' , 'host' ,
448462 '--push' ,
449463 '.'
450464 ]
451465 ] ,
452466 ] ) (
453- 'given %p with %p as inputs, returns %p' ,
454- async ( buildxVersion : string , inputs : Map < string , any > , expected : Array < string > ) => {
467+ '[%d] given %p with %p as inputs, returns %p' ,
468+ async ( num : number , buildxVersion : string , inputs : Map < string , any > , expected : Array < string > ) => {
455469 await inputs . forEach ( ( value : string , name : string ) => {
456470 setInput ( name , value ) ;
457471 } ) ;
458472 const defContext = context . defaultContext ( ) ;
459473 const inp = await context . getInputs ( defContext ) ;
460- console . log ( inp ) ;
461474 const res = await context . getArgs ( inp , defContext , buildxVersion ) ;
462- console . log ( res ) ;
463475 expect ( res ) . toEqual ( expected ) ;
464476 }
465477 ) ;
@@ -469,63 +481,54 @@ describe('getInputList', () => {
469481 it ( 'single line correctly' , async ( ) => {
470482 await setInput ( 'foo' , 'bar' ) ;
471483 const res = await context . getInputList ( 'foo' ) ;
472- console . log ( res ) ;
473484 expect ( res ) . toEqual ( [ 'bar' ] ) ;
474485 } ) ;
475486
476487 it ( 'multiline correctly' , async ( ) => {
477488 setInput ( 'foo' , 'bar\nbaz' ) ;
478489 const res = await context . getInputList ( 'foo' ) ;
479- console . log ( res ) ;
480490 expect ( res ) . toEqual ( [ 'bar' , 'baz' ] ) ;
481491 } ) ;
482492
483493 it ( 'empty lines correctly' , async ( ) => {
484494 setInput ( 'foo' , 'bar\n\nbaz' ) ;
485495 const res = await context . getInputList ( 'foo' ) ;
486- console . log ( res ) ;
487496 expect ( res ) . toEqual ( [ 'bar' , 'baz' ] ) ;
488497 } ) ;
489498
490499 it ( 'comma correctly' , async ( ) => {
491500 setInput ( 'foo' , 'bar,baz' ) ;
492501 const res = await context . getInputList ( 'foo' ) ;
493- console . log ( res ) ;
494502 expect ( res ) . toEqual ( [ 'bar' , 'baz' ] ) ;
495503 } ) ;
496504
497505 it ( 'empty result correctly' , async ( ) => {
498506 setInput ( 'foo' , 'bar,baz,' ) ;
499507 const res = await context . getInputList ( 'foo' ) ;
500- console . log ( res ) ;
501508 expect ( res ) . toEqual ( [ 'bar' , 'baz' ] ) ;
502509 } ) ;
503510
504511 it ( 'different new lines correctly' , async ( ) => {
505512 setInput ( 'foo' , 'bar\r\nbaz' ) ;
506513 const res = await context . getInputList ( 'foo' ) ;
507- console . log ( res ) ;
508514 expect ( res ) . toEqual ( [ 'bar' , 'baz' ] ) ;
509515 } ) ;
510516
511517 it ( 'different new lines and comma correctly' , async ( ) => {
512518 setInput ( 'foo' , 'bar\r\nbaz,bat' ) ;
513519 const res = await context . getInputList ( 'foo' ) ;
514- console . log ( res ) ;
515520 expect ( res ) . toEqual ( [ 'bar' , 'baz' , 'bat' ] ) ;
516521 } ) ;
517522
518523 it ( 'multiline and ignoring comma correctly' , async ( ) => {
519524 setInput ( 'cache-from' , 'user/app:cache\ntype=local,src=path/to/dir' ) ;
520525 const res = await context . getInputList ( 'cache-from' , true ) ;
521- console . log ( res ) ;
522526 expect ( res ) . toEqual ( [ 'user/app:cache' , 'type=local,src=path/to/dir' ] ) ;
523527 } ) ;
524528
525529 it ( 'different new lines and ignoring comma correctly' , async ( ) => {
526530 setInput ( 'cache-from' , 'user/app:cache\r\ntype=local,src=path/to/dir' ) ;
527531 const res = await context . getInputList ( 'cache-from' , true ) ;
528- console . log ( res ) ;
529532 expect ( res ) . toEqual ( [ 'user/app:cache' , 'type=local,src=path/to/dir' ] ) ;
530533 } ) ;
531534
@@ -539,7 +542,6 @@ ccccccccc"
539542FOO=bar`
540543 ) ;
541544 const res = await context . getInputList ( 'secrets' , true ) ;
542- console . log ( res ) ;
543545 expect ( res ) . toEqual ( [
544546 'GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789' ,
545547 `MYSECRET=aaaaaaaa
563565ccc"`
564566 ) ;
565567 const res = await context . getInputList ( 'secrets' , true ) ;
566- console . log ( res ) ;
567568 expect ( res ) . toEqual ( [
568569 'GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789' ,
569570 `MYSECRET=aaaaaaaa
@@ -587,7 +588,6 @@ ccccccccc
587588FOO=bar`
588589 ) ;
589590 const res = await context . getInputList ( 'secrets' , true ) ;
590- console . log ( res ) ;
591591 expect ( res ) . toEqual ( [ 'GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789' , 'MYSECRET=aaaaaaaa' , 'bbbbbbb' , 'ccccccccc' , 'FOO=bar' ] ) ;
592592 } ) ;
593593
@@ -598,7 +598,6 @@ FOO=bar`
598598FOO=bar`
599599 ) ;
600600 const res = await context . getInputList ( 'secrets' , true ) ;
601- console . log ( res ) ;
602601 expect ( res ) . toEqual ( [ `GPG_KEY=${ pgp } ` , 'FOO=bar' ] ) ;
603602 } ) ;
604603
@@ -612,7 +611,6 @@ ccccccccc"
612611FOO=bar`
613612 ) ;
614613 const res = await context . getInputList ( 'secrets' , true ) ;
615- console . log ( res ) ;
616614 expect ( res ) . toEqual ( [
617615 'GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789' ,
618616 `MYSECRET=aaaaaaaa
0 commit comments