Karma and Webpack: Module not found: Error: Can't resolve './assets/images/phone.svg'


I am having an extremely hard time to get Unit Testing with Karma, Webpack and Ionic 3 to run. After moving through error after error related to Webpack I am now at this:

ERROR in ./src/+onboarding/onboarding-details/onboarding-details.component.html
Module not found: Error: Can't resolve './assets/images/phone.svg' in '/Users/tyrion/devel/saveup-mobile-front/src/+onboarding/onboarding-details'

I tried resolve extensions and module loaders in my webpack.test.js:

    module: {
        rules: [
                 test: /\.(png|jpg|svg)$/,
                 loader: 'url-loader?limit=8192'
    resolve: {
        extensions: ['.ts', '.js','.png','.svg']


npm install null-loader file-loader

No success. Please help.


I had the same issue. This tutorial helped me to set up the testing infrastructure correctly: