-
Notifications
You must be signed in to change notification settings - Fork 11.9k
use compileComponents() is not required with webpack #4757
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
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.
This would also mean async() isn't necessary correct?
You are right, i think that it's not necessary. |
These should still be in there. You're right that when using the @ngtools/webpack plugin we don't need those (mostly because there's no fetch calls). However, there's no hard performance implication for having those and they ARE best practices for every test. We aim at aligning very closely with the Angular official style guide which recommends calling those for every async test. Please also note that even if we use webpack internally, we still try to hide webpack from the user. This uses an implementation detail that we could switch in the future (or the user decides to stop using the CLI) and all the tests would be rendered invalid. TL;DR: this is not broken, this does not impact performance, it's best practice, so we don't need to change it. |
Hi @hansl ,
At which Angular official style guide you refer ? |
Furthermore, compileComponents () is asynchronous. So, we must use async () method like this: BeforeEach` (async (() => {
TestBed.configureTestingModule ({
Declarations: [BannerComponent], // declare the test component
})
.compileComponents (); // compile template and css
})); not BeforeEach (() => {
TestBed.configureTestingModule ({
Declarations: [BannerComponent], // declare the test component
})
TestBed.compileComponents (); // compile template and css
}); I will open a issue. |
Hi, angular.io now specifically states that if you use angular-cli you don't need to use compileComponents. Can removing the usage of this in the component schematic be revisited? |
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. |
Since we use webpack, we don't have to use compileComponents(). Webpack transforms html and css file to inline template.