-
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
fix(CLI): diff --template
crashes
#29896
Changes from 3 commits
79d4a51
c51f20e
0631c88
9d806f1
235f3ae
95efcf3
d9d29b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -624,6 +624,19 @@ test('metadata changes are rendered in the diff', () => { | |
expect(differences.resources.differenceCount).toBe(1); | ||
}); | ||
|
||
test('diff complains if it receives an undefined template', async () => { | ||
// GIVEN | ||
const currentTemplate: any = undefined; | ||
|
||
// WHEN | ||
const newTemplate = { | ||
Resources: {}, | ||
}; | ||
|
||
// THEN | ||
expect(() => fullDiff(currentTemplate, newTemplate)).toThrow(/trying to diff a template that is not defined/); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From this code I can get why there is this check. But how would an actual user end up with this? How can they fix it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A user would never end up with this. I added it because diff is design to work on arbitrary json objects, but it achieves this by typing things as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason this change got through is it looked innocuous and it didn't break any tests, because we had just never tested fixed-template diffs before |
||
}); | ||
|
||
describe('changeset', () => { | ||
test('changeset overrides spec replacements', () => { | ||
// GIVEN | ||
|
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.
What does that error even mean? How do I fix this?