You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are in dire need of some documentation on how to test ionic in angular.
The current documentation explains the theory behind testing but does not go into ionic specifics. I'd argue that the theory behind what is a unit test has been covered elsewhere in more detail and so it's not important for the ionic docs to go over that.
What we could use is knowing how to correctly bootstrap ionic so that components are loaded correctly and can be tested. I know theres some nuances due to ionics web component architecture. Some of it is explained on stencil docs and elsewhere.
While I've been able to figure out some things through looking the ionic source code and also a bit of blind luck there are some things I haven't been able to determine yet. For example when testing a standalone project it's not clear how to bootstrap ionic in testbed or whether its required at all? Using provideIonicAngular() doesn't seem to render any components but importing IonicModule does (but only if calling forRoot).
TestBed.configureTestingModule({
providers: [
importProvidersFrom(IonicModule.forRoot()), <<< - works but is this right?
provideIonicAngular({}), // does not render but is more alike to real world
],
}).compileComponents()
But there are issues with using IonicModule.forRoot as described here ionic-team/ionic-framework#23173 (comment) hence why standalone is a good idea but these components don't seem to render?
Any advice is helpful on this to point us in the right direction 🙏
The text was updated successfully, but these errors were encountered:
URL
https://ionicframework.com/docs/angular/testing
Issue Description
We are in dire need of some documentation on how to test ionic in angular.
The current documentation explains the theory behind testing but does not go into ionic specifics. I'd argue that the theory behind what is a unit test has been covered elsewhere in more detail and so it's not important for the ionic docs to go over that.
What we could use is knowing how to correctly bootstrap ionic so that components are loaded correctly and can be tested. I know theres some nuances due to ionics web component architecture. Some of it is explained on stencil docs and elsewhere.
While I've been able to figure out some things through looking the ionic source code and also a bit of blind luck there are some things I haven't been able to determine yet. For example when testing a standalone project it's not clear how to bootstrap ionic in testbed or whether its required at all? Using
provideIonicAngular()
doesn't seem to render any components but importing IonicModule does (but only if calling forRoot).But there are issues with using
IonicModule.forRoot
as described here ionic-team/ionic-framework#23173 (comment) hence why standalone is a good idea but these components don't seem to render?Any advice is helpful on this to point us in the right direction 🙏
The text was updated successfully, but these errors were encountered: