Skip to content
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

feat(@schematic/angular): enable ivy in tests #15044

Merged
merged 1 commit into from
Jul 15, 2019

Conversation

cexbrayat
Copy link
Member

If a project is generated with enableIvy, this commit adds the necessary configuration to tsconfig.spec.json to then run the tests with Ivy. Note that the CLI already does the correct work (runs ngcc and then runs the tests).

cc @filipesilva as we talked about it on Slack

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Jul 11, 2019

This relates to #14547.

With this option your are indeed optioning in to use ngcc but ts transpiration still happens using tsc and not ngtsc. Is this what we want? Ie, still using JIT builds during tests?

Should we have an AOT option to run tests in ivy and transpile using ngtsc, or always AOT, or always JIT?

@filipesilva
Copy link
Contributor

Yes, we still want unit tests to run with JIT. We just want to ensure that ngcc is ran if needed. For instance if you make a new project and run tests before build. Or if you have some angular libs only on test.

As to having the flag on the spec tsconfig or root tsconfig.... if we have them in individual tsconfigs it will be harder for the user to opt-in or opt back out. And in general we don't really expend a lot of testing in making sure mixed Ivy/VE environments are working properly.

So maybe we should instead have it only on the workspace tsconfig and be done with it. That way it's a single config change. If you really need to have a non-Ivy project, you can opt-out in their leaf tsconfigs too.

At this point I'm kicking myself for not thinking about this earlier. https://angular.io/guide/ivy would also need to change to mention the workspace tsconfig.

@alan-agius4
Copy link
Collaborator

I do agree with having the option in the workspace tsconfig. Another option would be to have the specs tsconfig extend the app tsconfig.

Though with the first approach, a user is not creating an ivy application but rather an ivy workspace. Ie: the enableIvy option in the application schematics will be made redundant.

Adding the option in the workspace config will also break ng g library by default unless we update the library tsconfig to disable ivy.

@filipesilva filipesilva added the needs: discussion On the agenda for team meeting to determine next steps label Jul 11, 2019
@alan-agius4 alan-agius4 added the target: major This PR is targeted for the next major release label Jul 11, 2019
Copy link
Collaborator

@alan-agius4 alan-agius4 left a comment

Choose a reason for hiding this comment

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

@cexbrayat, we will go ahead with this.

Can you please fix the commit msg scope to @schematics/angular?

Thanks.

@alan-agius4 alan-agius4 removed the needs: discussion On the agenda for team meeting to determine next steps label Jul 11, 2019
If a project is generated with `enableIvy`, this commit adds the necessary configuration to `tsconfig.spec.json` to then run the tests with Ivy. Note that the CLI already does the correct work (runs `ngcc` and then runs the tests).
@cexbrayat
Copy link
Member Author

@alan-agius4 👍 Done

@mgechev mgechev merged commit 9d4d574 into angular:master Jul 15, 2019
@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 Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants