-
Notifications
You must be signed in to change notification settings - Fork 6.8k
test: fix schematic test infrastructure failing with Angular CLI v10 #19749
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: fix schematic test infrastructure failing with Angular CLI v10 #19749
Conversation
Angular CLI v10 generates tsconfig files with comments inside it. This breaks our testing infrastructure for schematics that leverages the basic `JSON.parse`. To not throw for such tsconfig files that are parsed by our testing infrastructure, we need to use JSON5.
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.
LGTM
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.
LGTM
// Parse TypeScript configuration files with JSON5 as they could contain comments or | ||
// unquoted properties. | ||
const testAppTsconfig = | ||
parseJson(appTree.readContent(testAppTsconfigPath), JsonParseMode.Json5) as any; |
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.
Nit that can be addressed later: I think TS has an interface for the config somewhere which we could reference here instead of any
.
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 don't think there is such an interface. IIRC there is only ts.CompilerOptions
and that deals only with the compiler options, and also relies on enum values. Let me know if you find something. That would definitely be ideal 😄
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.
In language service ts.readConfigFile()
is used to parse JSON. It returns any
though.
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.
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.
Yeah, that would be a good alternative. Might just use that one when I come across it again. Looks like it would require us to handle parse diagnostics manually though.
…19749) Angular CLI v10 generates tsconfig files with comments inside it. This breaks our testing infrastructure for schematics that leverages the basic `JSON.parse`. To not throw for such tsconfig files that are parsed by our testing infrastructure, we need to use JSON5.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Angular CLI v10 generates tsconfig files with comments inside it. This
breaks our testing infrastructure for schematics that leverages
the basic
JSON.parse
. To not throw for such tsconfig files thatare parsed by our testing infrastructure, we need to use JSON5.