aws / aws/aws-cdk

(assertions): argument to skip bundling of assets

Open
#18,125 14 comments 42 reactions 0 assignees View on GitHub
@aws-cdk/assertions @aws-cdk/core effort/medium feature-request p1
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
1d 19h
Merged PRs (30d)
74

Description

### Description

When running `assertions.Template.from_stack(stack)`, one cannot skip the bundling of assets during synthesis/generation of the CloudFormation template.

### Use Case

When writing unit-tests that leverage the `assertions` library, assets do not always have to be created to check the synthesized template. Depending on how many assets are created (and their bundling strategy), the process can be lengthy. This feature-request is for an argument which can disable bundling of assets.

### Proposed Solution

`assertions.Template.from_stack(stack, bundle_assets=False)`

### Other information

I tried doing something like below, to no avail:

```python
@jsii.implements(IAspect)
class MockAssetStaging:
def __init__(self, fake_stage: AssetStaging):
self.fake_stage = fake_stage

def visit(self, node):
if isinstance(node, AssetStaging):
node = self.fake_stage

app = App()
core_stack = CoreStack(...)

fake_staged_asset = AssetStaging(core_stack, "fake", source_path=f"./hello_world.py")
Aspects.of(app).add(MockAssetStaging(fake_staged_asset))
```

### Acknowledge

- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

Contributor guide

Open the contributing guide

Research direction

Start at assertions.Template.from_stack(stack), then trace how stack synthesis invokes asset bundling. The change is complete when the proposed bundle_assets=False argument lets assertion-based template generation skip asset bundling while preserving the existing default behavior; no specific files or tests are named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, typescript
Domain
testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.