Hello - I've added angular-moment directive and filters for moment.js to my meanjs app and it works fine at app runtime (I can use the moment directives), but when I run tests it fails my karma test run because it cannot resolve the angularMoment module dependency in the test context... ideas?
I saw
this Stack Overflow article which seems to be my problem, but looking at config/config.js I don't see how to add angular-moment and moment.js to my test dependencies. Obviously I'm missing something.
To add to my application I added to applicationModuleVendorDependencies in config.js
var applicationModuleVendorDependencies = ['ngResource', 'ngCookies', 'ngAnimate', 'ngTouch', 'ngSanitize', 'ui.router', 'ui.bootstrap', 'ui.utils', 'angularMoment'];
and then to my template in app/views/layout.server.view.html (although I maybe shouldn't have to do this?)
<!-- moment support -->
<script src="lib/moment/moment.js"></script>
<script src="lib/angular-moment/angular-moment.js"></script>
The server mocha tests all pass (and as I said I can use moment in my app) but I'm not injecting angularMoment into the app when in karma test context... unfortunately it then fails in a way that is both spectacular and useless :}. There's probably something simple I need to add to make this resolution work for test runs but can't see it... TIA for any help - Michael
Running "karma:unit" (karma) task
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 1.9.7 (Mac OS X)]: Connected on socket ZBPZSdPrNn12QjTpb_uj with id 88347748
PhantomJS 1.9.7 (Mac OS X) ArticlesController $scope.find() should create an array with at least one article object fetched from XHR FAILED
Error: [$injector:modulerr] Failed to instantiate module opinulate due to:
Error: [$injector:modulerr] Failed to instantiate module angularMoment due to:
Error: [$injector:nomod] Module 'angularMoment' 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.
at /Users/michael/projects/test/public/lib/angular/angular.js:1613
at ensure (/Users/michael/projects/test/public/lib/angular/angular.js:1535)
at module (/Users/michael/projects/test/public/lib/angular/angular.js:1823)
at /Users/mmurray/projects/opinulate/public/lib/angular/angular.js:3781