-
Notifications
You must be signed in to change notification settings - Fork 94
fix: fix config for testing with zoneless Angular #535
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
Thanks for raising this PR @mikeshtro
I also got a question. Do you think it's useful to also add this config to the render
method, because currently it's set at the global level using the configure
method.
My reasoning is that either you use zoneless or not for the whole application, and thus it isn't needed to set at test-level.
My original idea was to add it to the render
method, because I consider it to be the main method, how I setup my tests when using testing library.
But as you described we use zoneless or not for the whole application and so I think the configure
method is enough, because it covers the main scenario. If we want to configure it at test-level we can always provide it manually
render(MyComponent, { providers: [provideZonelessChangeDetection()] })
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.
Thanks @mikeshtro !
06bb84e
into
testing-library:beta
@all-contributors please add @mikeshtro for code, bug
I've put up a pull request to add @mikeshtro! 🎉
This PR fixes zoneless flag in the configure function. I tried to use the configure function with zoneless flag
but I got error
Unexpected value 'undefined' imported by the module 'DynamicTestModule'. Please add an @NgModule annotation.
This is because
provideZonelessChangeDetection
is incorrectly used insideimports
instead ofproviders
.