Mdb Mdb - 4 months ago 6x
AngularJS Question

Is there a way to reduce the number of references declared in jasmine unit tests

I am using jasmine to test my angular code.

On the top of each file with specs I am having a bunch of references.

For example these are the references I need in one of my tests:

/// <reference path="../../../../../Project/Scripts/angular.js" />
/// <reference path="../../../../../Project/Scripts/angular-route.js" />
/// <reference path="../../../../../Project/Scripts/angular-mocks.js" />
/// <reference path="../../../../../Project/Scripts/angular-animate.js" />
/// <reference path="../../../../../Project/Scripts/App/app.js" />
/// <reference path="../../../../../Project/Scripts/App/Common/Directives/ngProgress.js" />
/// <reference path="../../../../../Project/Scripts/App/Modules/Naviagation/navigationApp.js" />
/// <reference path="../../../../../Project/Scripts/App/Common/Directives/angularBootstrapNavTree.js" />
/// <reference path="../../../../../Project/Scripts/App/Common/Factories/commonFactory.js" />
/// <reference path="../../../../../Project/Scripts/App/Modules/Naviagation/NavigationBar/navigationFactory.js" />

Is there another way to declare all those references. For example, something like:

/// <reference path="../../../../../Project/Scripts/* (this does not work)



Chutzpah does let you do that in a few different ways.

One way is to have a reference path to a folder (omit that *):

/// <reference path="../../../../../Project/Scripts" />

That will get all files (recursively) in that folder.

If you want more control you can use the references setting in a chutzpah.json file

    "References": [
        { "Path": "../../../../../Project/Scripts", "Include": "*.js", "Exclude": "*Resource*" }