getting ReferenceError: Can't find variable: angular

angularjs, javascript, yeoman

Solution

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.

Problem

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

Original source