测试angularjs控制器时 - 无法找到变量:module/inject by chutzpah

net*_*jor 8 javascript jasmine chutzpah angularjs visual-studio-2012

我有angularJs控制器

angular.module('App.ctrl.guests', [])
    .controller('guestsController', ['$scope', '$http', '$location', '$timeout', 'guestsService', function ($scope, $http, $location, $timeout, guestsService) {
        $scope.tiles = [];
    }])
Run Code Online (Sandbox Code Playgroud)

和茉莉花测试

/// <reference path="~/Scripts/angular.js" />
/// <reference path="../../ProjectWeb/Scripts/app/guests/guestsCtrl.js" />
/// <reference path="~/Scripts/angular-mocks.js" />
/// <reference path="~/Scripts/jasmine.js" />
'use strict';
describe('App.ctrl.guests', function () {
    var scope, controller;
    beforeEach(function () {
        module('App.ctrl.guests')
    });
    beforeEach(inject(function ($rootScope, $controller) {
        scope = $rootScope.$new();
        controller = $controller('guestsController', {
            $scope: scope
        });
    }));

    it('should have empty array', function () {
        expect(scope.tiles).toBe([]);
    });
})
Run Code Online (Sandbox Code Playgroud)

每次我在Visual studio chutzpah运行时,我得到:

ReferenceError:找不到变量:file in file:///.../JasmineTests/guestsControllerTest.js(第5行)

ReferenceError:无法找到变量:inject in file:///.../JasmineTests/guestsControllerTest.js(第12行)

这是一个问题,参考angular.js和茉莉花不知道什么是模块/注入关键字?这是我第一次用js测试:/

net*_*jor 4

我在这篇文章中找到了如何拖放 JavaScript 文件以进行测试和正确的路径。