Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getting ReferenceError: Can't find variable: angular

I am new to yeoman and all the tools it uses. I have created a test project in yeoman and trying to run the test spec in jasmine. I have installed the jasmine plugin using cmd:

npm install grunt-contrib-jasmine --save-dev

Added a jasmine task in Gruntfile.js

jasmine: {
        src:    '<%= yeoman.app %>/scripts/{,*/}*.js',
        specs: 'test/spec/{,*/}*.js'
    },

when i run the jasmine task grunt jasmine i get following error:-

E:\Personal Projects\yeoman-projects\test-app>grunt jasmine
Running "jasmine:src" (jasmine) task

Testing jasmine specs via phantom
ReferenceError: Can't find variable: angular at
..\..\..\E:\Personal%20Projects\yeoman-projects\test-app\app\scripts\app.js:3

ReferenceError: Can't find variable: angular at
..\..\..\E:\Personal%20Projects\yeoman-projects\test-app\app\scripts\controll
ers\main.js:3

Following is my main.js

'use strict';

angular.module('testAppApp')
  .controller('MainCtrl', function ($scope) {
    $scope.awesomeThings = [
      'HTML5 Boilerplate',
      'AngularJS',
      'Karma'
    ];
  });

and app.js

'use strict';

angular.module('testAppApp', [
  'ngRoute'
])
  .config(function ($routeProvider) {
    $routeProvider
      .when('/', {
        templateUrl: 'views/main.html',
        controller: 'MainCtrl'
      })
      .otherwise({
        redirectTo: '/'
      });
  });

Am i missing something ?

Thanks, Parikshit

like image 842
Parikshit Avatar asked Jan 13 '14 14:01

Parikshit


1 Answers

under jasmine src you have to include angular.js. For now you have only included you own scripts. If you are using yeaoman, they are usally in a folder called bower_components/angular.

like image 91
michael Avatar answered Oct 23 '22 19:10

michael