-
Notifications
You must be signed in to change notification settings - Fork 4k
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
test(cli): ensure that all commands have explicit bundling configurations #33342
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This review is outdated)
eddb918
to
9e0d3f5
Compare
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #33342 +/- ##
=======================================
Coverage 80.92% 80.92%
=======================================
Files 236 236
Lines 14253 14254 +1
Branches 2490 2490
=======================================
+ Hits 11534 11535 +1
Misses 2434 2434
Partials 285 285
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -35,7 +35,7 @@ export enum Command { | |||
DOCTOR = 'doctor', | |||
} | |||
|
|||
const BUNDLING_COMMANDS = [ | |||
export const BUNDLING_COMMANDS = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea but i'm not a fan of exporting just for the sake of a unit test. It makes the unit test somewhat brittle because they rely heavily on implementation, and not on behavior. A better option would be to enforce each command to specify whether it is bundling or not, during command creation. So for example:
export interface Command {
bundling: boolean;
name: string;
}
export const Commands: Command[] = [
{ name: 'ls', bundling: false },
....
]
const bundlingCommands = Commands.filter(c => c.bundling);
That way we don't really need a test for it, because its enforced by the compiler.
This also opens the door for additional command specific configuration we might need in the future.
I recognize this would be a larger change, and maybe its worth syncing with @mrgrain as part of toolkit refactoring. Let me know what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to @iliapolo suggestion.
This will have to work very differently for the Toolkit, because bundling
is something that controls CloudAssembly
behavior. In the CLI we have a strict 1:1 mapping between CloudAssembly
and CLI command. However in the toolkit, one can use the same CloudAssembly
for different Toolkit actions. Not quite sure how to go about this yet. 🤔
cabbb70
to
7d7129c
Compare
➡️ PR build request submitted to A maintainer must now check the pipeline and add the |
cfe73bb
to
e7004e7
Compare
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Issue #31999
Reason for this change
BUNDLING_COMMANDS
is a list used to specify CLI commands that require code to be bundled. The CDK Import feature was not added to this list, but requires bundling for certain constructs (like NodeJSFunction lambda).Description of changes
Removed list
BUNDLING_COMMANDS
.Added interface
ConfiguredCommand
, which requires bundling to be set to a boolean value.Added type
CommandType
, which ensures that each Command enum member has a corresponding key inConfiguredCommands
.Describe any new or updated permissions being added
No permissions changes.
Description of how you validated changes
This is a refactor. The compiler validated the accuracy of the changes.
Integration test run.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license