Jasmine testing Ionic Icons svg not found

Issue

enter image description here

When I try to test my Ionic/Angular app with Jasmine it can’t seem to find any of the Ionic Icons I used, so it throws a 404 for all of them. All the tests pass but its hard to read since the errors take up quite a lot of space so if one does fail its annoying.

The icon do work in the normal code.

How do I include the SVGs into my tests?

Solution

I think in the imports array of TestBed.configureTestingModule, you need to import that module responsible for painting the Ionic Icons.

You can also set up proxies to get rid of those 404 errors as outlined in this post: https://stackoverflow.com/a/58291420/7365461.

Answered By – AliF50

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published