Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(docs): nodejs-function, document how to disable bundling for tests #12844

Open
2 tasks
nbaillie opened this issue Feb 3, 2021 · 6 comments
Open
2 tasks

(docs): nodejs-function, document how to disable bundling for tests #12844

nbaillie opened this issue Feb 3, 2021 · 6 comments
Labels
@aws-cdk/pipelines CDK Pipelines library docs/inline Related to inline documentation of the API Reference effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. good first issue Related to contributions. See CONTRIBUTING.md p2

Comments

@nbaillie
Copy link
Contributor

nbaillie commented Feb 3, 2021

Create an option to disable, (or automatically disable?) asset build/bundling, when using Jest to instantiate a cdk-pipeline for tests

Use Case

When using a pipeline instance in jest it causes the assets to build/bundle, it may be the intention of the test to check only that the pipeline is correctly formed, build/bundle testing may be handled else where.
In this case the build/bundle process creates additional time delay on testing in synth stage of the pipeline.

Proposed Solution

Create an option to disable, (or automatically disable?) asset build/bundling, when using Jest to instantiate a cdk-pipeline for tests

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

@nbaillie nbaillie added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Feb 3, 2021
@peterwoodworth peterwoodworth added the @aws-cdk/pipelines CDK Pipelines library label Feb 3, 2021
@rix0rrr
Copy link
Contributor

rix0rrr commented Feb 8, 2021

I believe there's an context value you can set to stop bundling (or more accurately, pick the stacks for which you want to enable bundling, which in your case would be none):

const bundlingStacks: string[] = this.node.tryGetContext(cxapi.BUNDLING_STACKS) ?? ['*'];

export const BUNDLING_STACKS = 'aws:cdk:bundling-stacks';

@rix0rrr rix0rrr changed the title (aws-cdk/pipelines): option to disable asset build/bundling, when using Jest to instantiate a pipeline for tests (docs): nodejs-function, document how to disable bundling for tests Feb 8, 2021
@rix0rrr
Copy link
Contributor

rix0rrr commented Feb 8, 2021

I'm assuming you're using NodeJSFunction or PythonFunction in your pipeline...

@rix0rrr rix0rrr added docs/inline Related to inline documentation of the API Reference effort/small Small work item – less than a day of effort p2 good first issue Related to contributions. See CONTRIBUTING.md labels Feb 8, 2021
@nbaillie
Copy link
Contributor Author

nbaillie commented Feb 8, 2021

Thanks for the info above, I think this will help.

Yes using NodeJSFunction but another use case would be with s3-deploy.

@ryparker ryparker removed the needs-triage This issue or PR still needs to be triaged. label Jun 1, 2021
@rix0rrr rix0rrr removed their assignment Jun 3, 2021
@anthonygerrard
Copy link

I have a project which uses s3deployment bundling. I tried setting this context attribute in its tests but it led to build failures.

@bracki
Copy link
Contributor

bracki commented Sep 12, 2022

@rix0rrr Can you clarify what exactly needs to be done to disable this? I tried to do this programatically, but it seems the context variable can't be set at runtime? Do I need a separate cdk.json just for testing? That seems unfortunate.

@bracki
Copy link
Contributor

bracki commented Sep 12, 2022

#18125 has some answers. #18125 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/pipelines CDK Pipelines library docs/inline Related to inline documentation of the API Reference effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. good first issue Related to contributions. See CONTRIBUTING.md p2
Projects
None yet
Development

No branches or pull requests

6 participants