Reputation: 1341
I'm trying to test my TypeScript and AngularJS code with Jasmine in Visual Studio Chutzpah. Test is running correctly in karma, but I realy like Chutzpah's UI.
My controllerSpecs.ts
:
/// <chutzpah_reference path="../Scripts/angular.js" />
/// <chutzpah_reference path="../Scripts/angular-mocks.js" />
/// <chutzpah_reference path="../Scripts/angular-route.js" />
/// <chutzpah_reference path="../Scripts/angular-resource.js" />
/// <chutzpah_reference path="../Scripts/angular-local-storage.js" />
/// <chutzpah_reference path="../Controllers/MenuController.js" />
/// <chutzpah_reference path="../App/app.js" />
/// <chutzpah_reference path="../references.js" />
/// <reference path="../references.ts" />
describe('Controller Specs', () => {
describe('Menu Controller Specs', () => {
var menuCtrl, scope;
beforeEach(angular.mock.module('typewritingApp'));
beforeEach(() => inject(($rootScope) => {
scope = $rootScope.$new();
menuCtrl = new App.MenuCtrl(scope);
}));
it('should be true', () => {
expect(true).toBe(true);
});
});
});
My app.ts
:
module App {
var typewritingapp: ng.IModule = angular.module("typewritingApp", [])
.controller("MenuCtrl", ["$scope", MenuCtrl])
}
My MenuController.ts
:
module App {
export class MenuCtrl {
constructor($scope: any) {
$scope.pageTitle = "Menu";
}
}
}
If I change the angular.mock.module
part to module
in the test (and I also need to modify the angular-mocks.d.ts to declare module) I receive the same error but it doesn't find variable: module.
Upvotes: 0
Views: 527
Reputation: 1341
I had a wrong karma config file and after it has started to work I forgot to update chutzpah.json so it was my fault. Thanks for the help @MatthewManela
Upvotes: 0