-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
fix(lambda-nodejs): esbuild define parameters are incorrectly encoded #14065
Merged
mergify
merged 6 commits into
aws:master
from
skyrpex:skyrpex/fix-esbuild-define-parameters
Apr 12, 2021
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a7552df
fix(aws-lambda-nodejs): esbuild define parameters are incorrectly enc…
skyrpex 38bfb8c
wip
skyrpex fd4e86d
wip: add esbuild CLI test to ensure that the define instructions work…
skyrpex 04abd39
wip
skyrpex 3c7e82d
Update packages/@aws-cdk/aws-lambda-nodejs/test/bundling.test.ts
skyrpex 5611eff
Merge branch 'master' into skyrpex/fix-esbuild-define-parameters
mergify[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
packages/@aws-cdk/aws-lambda-nodejs/test/__snapshots__/bundling.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`esbuild bundling with esbuild options 1`] = ` | ||
"(() => { | ||
// test/integ-handlers/define.ts | ||
function handler() { | ||
return [ | ||
\\"VALUE\\", | ||
true, | ||
7777, | ||
'this is a \\"test\\"' | ||
]; | ||
} | ||
})(); | ||
" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/define.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export function handler() { | ||
return [ | ||
process.env.KEY, | ||
process.env.BOOL, | ||
process.env.NUMBER, | ||
process.env.STRING, | ||
]; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do you think we really need to run
esbuild
here in the test? Isn't it enough to ensure that the right command line args are passed?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.
Well, I got it right this time and reverse-engineered the define parameters' expectation (it's a hell plenty of escape slashes). It should be stable now and the test is not exactly necessary, but it's proof that it works now.
Let me know if you want me to remove it 👍🏻
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 that this is doing an end to end test