-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cli): hide diffs of mangled unicode strings
CloudFormation's `GetStackTemplate` irrecoverably mangles any character not in the 7-bit ASCII range. This causes noisy output from `cdk diff` when a template contains non-English languages or emoji. We can detect this case and consider these strings equal. This can be disabled by passing `--strict`. *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Showing
5 changed files
with
39 additions
and
3 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export * from './diff-template'; | ||
export * from './format'; | ||
export * from './format-table'; | ||
export { deepEqual } from './diff/util'; | ||
export { deepEqual, mangleLikeCloudFormation } from './diff/util'; |
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,10 @@ | ||
import { mangleLikeCloudFormation } from '../lib/diff/util'; | ||
|
||
test('mangled strings', () => { | ||
expect(mangleLikeCloudFormation('foo')).toEqual('foo'); | ||
expect(mangleLikeCloudFormation('文字化け')).toEqual('????'); | ||
expect(mangleLikeCloudFormation('🤦🏻♂️')).toEqual('?????'); | ||
expect(mangleLikeCloudFormation('\u{10ffff}')).toEqual('?'); | ||
expect(mangleLikeCloudFormation('\u007f')).toEqual('\u007f'); | ||
expect(mangleLikeCloudFormation('\u0080')).toEqual('?'); | ||
}); |
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