4
votes

I am using Chutzpah in Visual Studio 2013 Update 2, and I am trying to do some unit testing using jasmine for AngularJS. The problem is that for some reason chutzpan thinks my reference javascript files are files to test.
No matter where I include the reference files (in the test file or Chutzpah.json), I get the same errors.
For example, if I include:

/// <reference path="Scripts/angular.js" />
/// <reference path="Scripts/angular-mocks.js" />
/// <reference path="../codeToTest" />

describe('Controller: myController', function () {

    beforeEach(module('myApp'));
});

I get:

Error: TypeError: 'undefined' is not an object (evaluating 'angular.mock = {}')  

and

ReferenceError: Can't find variable: module in file.

Any ideas where I am wrong? Thank you!

Update: So guys, I solve the problem just by adding reference files in both test files and chutzpah.json.

1
It is hard to tell from just that what might be wrong. Could you share a full repro?Matthew Manela
Thanks for the answer and sorry for the late call from me! The problem was solved after setting the reference files in both chutzpah.json and test file. Now everything runs great!Stoyan Stoyanov
as per @kingkeamo, more information may be found here: robzhu.com/blog/2014/10/26/…peterchen

1 Answers

3
votes

You have two choices here. You can either create a chutzpah.json file and include the references there, or you can change /// reference to /// chutzpah_reference You can find more info here: https://chutzpah.codeplex.com/wikipage?title=Chutzpah%20File%20References