lathonez / clicker

Ionic 2 + @angular/cli Seed Project : Angular2 + Typescript + Karma + Protractor + Travis
http://lathonez.com/2018/ionic-2-unit-testing/
MIT License
430 stars 137 forks source link

Unit testing IonicPageModule & IonicModule #255

Closed alexmgrant closed 7 years ago

alexmgrant commented 7 years ago

Any thoughts on the setup for testing an app using Ionic's lazy loading?

lathonez commented 7 years ago

Hi Alex.

I've not used it (or looked at it at all) until just now. Looks like something we will need to use though.

Having a quick scan of the blog, I can't see that the testing setup would need to be any different.

What issues are you running into?

Stephen

lathonez commented 7 years ago

Please reopen if you have anything to share

kalexmills commented 5 years ago

I am attempting to do this myself and I ran into a minor annoyance.

The beforeEachCompiler method expects that a component can be passed in. This works for normal components, but Pages can only be declared in one module. If a lazy loaded module is present, it complains that the page is also present in the DynamicTestModule

Solution in my case was to skip beforeEachCompiler and use configureIonicTestingModule instead.