angular+TS+jasmine+ng-html2js = 'Failed to instantiate module templates'. How to instantiate templates? Where is it forms?

165 Views Asked by At

Trying to unit test angular's 1 directive with template in separate file. Using jasmine and ng-html2js to stash html templates in $templateCache. On a project without SystemJS one can use:

beforeEach(module('MyStupidModule', 'templates'))

where templates - is in 'carma.conf.js'

    preprocessors: {
        'Content/templates/**/*.html' : ['ng-html2js']
    },

    ngHtml2JsPreprocessor:{
        moduleName: 'templates'
    },

and it works just fine.

But with SystemJS we now must instantiate both those modules in order to make them reachable. It is simple to mock my own module,

...
        mockAngularModule('MyStupidModule');
        // angular.mock.module('MyStupidModule');
        angular.mock.module('store', 'templates');
..

but where can I put instantiation of this 'template' module? Now it throws

Error: [$injector:modulerr] Failed to instantiate module templates due to: Error: [$injector:nomod] Module 'templates' is not available!

0

There are 0 best solutions below