@@ -408,6 +408,97 @@ test('can package individually without moving modules to root of zip-File with u
408
408
t . end ( ) ;
409
409
} ) ;
410
410
411
+ test ( 'can package individually, moving modules to root of zip-File with IndividuallyMoveUpModules=true' , t => {
412
+ process . chdir ( 'tests/base' ) ;
413
+ const path = npm ( [ 'pack' , '../..' ] ) ;
414
+ npm ( [ 'i' , path ] ) ;
415
+ sls ( [ '--individually=true' , '--moveup=true' , 'package' ] ) ;
416
+
417
+ const zipfiles_hello = listZipFiles ( '.serverless/hello.zip' ) ;
418
+ t . false (
419
+ zipfiles_hello . includes ( `fn2${ sep } __init__.py` ) ,
420
+ 'fn2 is not packaged in function hello'
421
+ ) ;
422
+ t . true (
423
+ zipfiles_hello . includes ( 'handler.py' ) ,
424
+ 'handler.py is packaged in function hello'
425
+ ) ;
426
+ t . false (
427
+ zipfiles_hello . includes ( `dataclasses.py` ) ,
428
+ 'dataclasses is not packaged in function hello'
429
+ ) ;
430
+ t . true (
431
+ zipfiles_hello . includes ( `flask${ sep } __init__.py` ) ,
432
+ 'flask is packaged in function hello'
433
+ ) ;
434
+
435
+ const zipfiles_hello4 = listZipFiles (
436
+ '.serverless/fn2-sls-py-req-test-dev-hello4.zip'
437
+ ) ;
438
+ t . true (
439
+ zipfiles_hello4 . includes ( `other.py` ) ,
440
+ 'fn2 is moved to root in function hello4'
441
+ ) ;
442
+ t . true (
443
+ zipfiles_hello4 . includes ( `dataclasses.py` ) ,
444
+ 'dataclasses is packaged in function hello4'
445
+ ) ;
446
+ t . false (
447
+ zipfiles_hello4 . includes ( `flask${ sep } __init__.py` ) ,
448
+ 'flask is not packaged in function hello4'
449
+ ) ;
450
+ t . false (
451
+ zipfiles_hello4 . includes ( `common${ sep } __init__.py` ) ,
452
+ 'module common is not packaged in function hello4'
453
+ ) ;
454
+
455
+ const zipfiles_hello5 = listZipFiles (
456
+ '.serverless/fn2-sls-py-req-test-dev-hello5.zip'
457
+ ) ;
458
+ t . true (
459
+ zipfiles_hello5 . includes ( `other.py` ) ,
460
+ 'fn2 is moved to root in function hello5'
461
+ ) ;
462
+ t . true (
463
+ zipfiles_hello5 . includes ( `dataclasses.py` ) ,
464
+ 'dataclasses is packaged in function hello5'
465
+ ) ;
466
+ t . false (
467
+ zipfiles_hello5 . includes ( `flask${ sep } __init__.py` ) ,
468
+ 'flask is not packaged in function hello5'
469
+ ) ;
470
+ t . true (
471
+ zipfiles_hello5 . includes ( `common${ sep } __init__.py` ) ,
472
+ 'module common is packaged in function hello5'
473
+ ) ;
474
+
475
+ const zipfiles_hello6 = listZipFiles (
476
+ '.serverless/fn3-sls-py-req-test-dev-hello6.zip'
477
+ ) ;
478
+ t . true (
479
+ zipfiles_hello6 . includes ( `fn3_handler.py` ) ,
480
+ 'fn3 is moved to root in function hello6'
481
+ ) ;
482
+ t . false (
483
+ zipfiles_hello6 . includes ( `fn2${ sep } __init__.py` ) ,
484
+ 'fn2 is not packaged in function hello6'
485
+ ) ;
486
+ t . false (
487
+ zipfiles_hello6 . includes ( `dataclasses.py` ) ,
488
+ 'dataclasses is packaged in function hello6'
489
+ ) ;
490
+ t . false (
491
+ zipfiles_hello6 . includes ( `flask${ sep } __init__.py` ) ,
492
+ 'flask is not packaged in function hello6'
493
+ ) ;
494
+ t . true (
495
+ zipfiles_hello6 . includes ( `common${ sep } __init__.py` ) ,
496
+ 'module common is packaged in function hello6'
497
+ ) ;
498
+
499
+ t . end ( ) ;
500
+ } ) ;
501
+
411
502
/*
412
503
* News tests not in test.bats
413
504
*/
0 commit comments