Skip to content

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

Conversation

devversion
Copy link
Member

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.

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.
@devversion devversion requested a review from jelbourn as a code owner June 24, 2020 21:06
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jun 24, 2020
@devversion devversion added merge safe target: patch This PR is targeted for the next patch release labels Jun 24, 2020
Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@crisbeto crisbeto added lgtm action: merge The PR is ready for merge by the caretaker labels Jun 24, 2020
// Parse TypeScript configuration files with JSON5 as they could contain comments or
// unquoted properties.
const testAppTsconfig =
parseJson(appTree.readContent(testAppTsconfigPath), JsonParseMode.Json5) as any;
Copy link
Member

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.

Copy link
Member Author

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 😄

Copy link

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.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

@devversion devversion Jun 24, 2020

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.

@jelbourn jelbourn merged commit f128a33 into angular:master Jun 24, 2020
jelbourn pushed a commit that referenced this pull request Jun 24, 2020
…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.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants