Running AngularJS tests with Resharper -


i'm trying implement angularjs application in typescript using visual studio. sample controller works, , i'm trying write , run tests. when create tests not related angular (for example, 1+1 == 2), runs fine. however, testing controller functionality doesn't seem work.

here's tests.ts file:

/// <reference path="../scripts/typings/jasmine/jasmine.d.ts"/> /// <reference path="../scripts/typings/angularjs/angular.d.ts" /> /// <reference path="../scripts/typings/angularjs/angular-mocks.d.ts" /> /// <reference path="../scripts/typings/angularjs/angular-scenario.d.ts" /> /// <reference path="../app/scripts/controllers.ts"/>  'use strict';  describe("unit controllers", () => {      beforeeach(() => module("thisapp"));      describe("sample controller", () => {          var scope: isamplescope;         var ctrl;          beforeeach(             function() {                 inject(                     function($rootscope: ng.irootscopeservice, $controller: ng.icontrollerservice) {                         scope = <isamplescope> $rootscope.$new();                         ctrl = $controller('samplectrl', { $scope: scope });                     }                 );             });          it("should have message", () => {             expect(element("#msg").text()).tobe("hello");         });      }); }) 

when running example, have 3 errors:

referenceerror: module not defined referenceerror: inject not defined referenceerror: element not defined 

i have added *.d.js files referenced files automatically added source, doesn't help.

my jasmine version in r# settings is. tried in browsers , phantom.js - result identically unsuccessful.

has managed working?

edit

apparently, issue called fact r# appends jasmine dependencies after references. then, angular-mocks.js checks window.jasmine in attempt register window.module , window.inject , fails.

i tried pre-include own version of jasmine , "bootloader" make initialize, solved problem module , inject not being defined, triggered whole avalanche of errors deeper down there.

although have included of reference comments, solve of type-checking , auto-completion requirements @ design-time; need remember add of scripts @ run-time, example including script tags in web page in right order.

you find either

  1. you missing <script> tag angular, or
  2. you have placed after tests script

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -