@@ -844,7 +844,45 @@ describe('staging', () => {
844
844
const dockerStubInput = readDockerStubInputConcat ( ) ;
845
845
// Docker ran for the asset in Stack1
846
846
expect ( dockerStubInput ) . toMatch ( DockerStubCommand . SUCCESS ) ;
847
- // DOcker did not run for the asset in Stack2
847
+ // Docker did not run for the asset in Stack2
848
+ expect ( dockerStubInput ) . not . toMatch ( DockerStubCommand . MULTIPLE_FILES ) ;
849
+ } ) ;
850
+
851
+ test ( 'correctly skips bundling with stack under stage and custom stack name' , ( ) => {
852
+ // GIVEN
853
+ const app = new App ( ) ;
854
+
855
+ const stage = new Stage ( app , 'Stage' ) ;
856
+ stage . node . setContext ( cxapi . BUNDLING_STACKS , [ 'Stage/Stack1' ] ) ;
857
+
858
+ const stack1 = new Stack ( stage , 'Stack1' , { stackName : 'unrelated-stack1-name' } ) ;
859
+ const stack2 = new Stack ( stage , 'Stack2' , { stackName : 'unrelated-stack2-name' } ) ;
860
+ const directory = path . join ( __dirname , 'fs' , 'fixtures' , 'test1' ) ;
861
+
862
+ // WHEN
863
+ new AssetStaging ( stack1 , 'Asset' , {
864
+ sourcePath : directory ,
865
+ assetHashType : AssetHashType . OUTPUT ,
866
+ bundling : {
867
+ image : DockerImage . fromRegistry ( 'alpine' ) ,
868
+ command : [ DockerStubCommand . SUCCESS ] ,
869
+ } ,
870
+ } ) ;
871
+
872
+ new AssetStaging ( stack2 , 'Asset' , {
873
+ sourcePath : directory ,
874
+ assetHashType : AssetHashType . OUTPUT ,
875
+ bundling : {
876
+ image : DockerImage . fromRegistry ( 'alpine' ) ,
877
+ command : [ DockerStubCommand . MULTIPLE_FILES ] ,
878
+ } ,
879
+ } ) ;
880
+
881
+ // THEN
882
+ const dockerStubInput = readDockerStubInputConcat ( ) ;
883
+ // Docker ran for the asset in Stack1
884
+ expect ( dockerStubInput ) . toMatch ( DockerStubCommand . SUCCESS ) ;
885
+ // Docker did not run for the asset in Stack2
848
886
expect ( dockerStubInput ) . not . toMatch ( DockerStubCommand . MULTIPLE_FILES ) ;
849
887
} ) ;
850
888
0 commit comments