Wednesday, 15 July 2015

javascript - ngRoute not instantiated by karma -


Do someone before me (using the module ()) and before each (injection ()) One way to find out the main description of my unit test ()?

When I include both

  first (module ('NGRUT'));  

and

  first each (injection (function () {}));  

In my test file's main description (), I get this. However, if I delete the first (inject () {}) code first, then ngRoute is loaded properly by Karma.

I have examined many other posts related to this issue. Like:

  • As per the above questions, make sure I have made That angular routes Js has been included in my index.html and I have also ensured that 'ngRoute' is the dependency of my app.

    Test file:

      Define (['ngmock', 'controllers / home / main-home-CTN'], function } {'Strict use'; only describe ('Controller: mainhouse controller', function) () (), (), (function (), before function () () (module ('ngRoute')) (Injection (function () {}); after each (function () {}); {});});});});  

    karma.config.js:

      files: [[Pattern: 'www / js / bootstrap.js', Includes: Incorrect}, {Pattern: 'www / js / lib / *. JS ', included: wrong}, {pattern:' www / js / controller / *. JS ', included: Incorrect}, {Pattern:' www /js/controllers/**/*.js ', includes: wrong}, {pattern:' www / js / instructions / *. JS ', Includes: Incorrect}, {Pattern:' www / js / directions / ** /*.js ', includes: Incorrect}, {Pattern:' www / js / factories / *. JS ', included: wrong}, {pattern:' www / js / factories / ** / *. JS ', included: wrong}, {pattern:' www / js / filter / *. JS ', included: wrong}, {pattern:' www / js / filter / ** / *. JS ', included: False}, {Pattern:' www / js / services / *. Js ', contains: wrong}, {pattern:' www / js / services / ** / *. Js ', included: wrong}, {pattern:' www-test / lib / * .js ', includes: wrong}, {pattern:' www-test / sp EC / ** / *. JS ', included: Incorrect}, {Pattern:' www-test / spec / ** / ** / *. Js', includes: wrong}, 'www-test / main-test Js',' www / js / lib / angular-route.js'],  

    angular-routes. Js is located at 'www / js / lib / angular-routes.js' and therefore the action should be included when the action runs my unit test.

    app.js:

      Define (['angular', 'angular', 'controller / index', 'direction / 'Index', 'factories / index', 'filter / index', 'service / index'], function (ng) {'strict experiment'; return ng.module ('ap', ['ngrut', 'ap. Controllers', 'AP DICIRX', 'App Factories',' App.filters', 'Apps Services']);});  

    Therefore, I found my rookie mistake to include an angular route in my production and dev code Is going but not in my test code because I only added the file to my output and dev folders.


    No comments:

    Post a Comment