mercredi 23 septembre 2015

How to solve unit test error in my case

I am running unit tests on my app and have encountered a problem.

In my app.js, I have included the third party modules I want like

angular.module(
    'myApp', [
        'third.party',
        'another.third.party',
    ]
);

My problem is I don't need to perforce the unit test for those third party files so I exclude them in my karma.conf.js

exclude: [
     'app/scripts/lib/thirdParty.js',
     'app/scripts/lib/anotherThirdParty.js'
],

Then I am getting

Error: [$injector:modulerr] Failed to instantiate module third.party due to:
Error: [$injector:nomod] Module 'third.party' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

when I run karma.

I don't want to include those third party files in my unit test report but I need them to be included in my app.js. How do I solve this issue?

Thanks!

Aucun commentaire:

Enregistrer un commentaire