{"action":"opened","issue":{"url":"https://api.github.com/repos/yeoman/generator-angular/issues/1314","repository_url":"https://api.github.com/repos/yeoman/generator-angular","labels_url":"https://api.github.com/repos/yeoman/generator-angular/issues/1314/labels{/name}","comments_url":"https://api.github.com/repos/yeoman/generator-angular/issues/1314/comments","events_url":"https://api.github.com/repos/yeoman/generator-angular/issues/1314/events","html_url":"https://github.com/yeoman/generator-angular/issues/1314","id":153039757,"number":1314,"title":"Karma Jasmine Unit Testing","user":{"login":"MarianoPinto","id":15549358,"avatar_url":"https://avatars.githubusercontent.com/u/15549358?v=3","gravatar_id":"","url":"https://api.github.com/users/MarianoPinto","html_url":"https://github.com/MarianoPinto","followers_url":"https://api.github.com/users/MarianoPinto/followers","following_url":"https://api.github.com/users/MarianoPinto/following{/other_user}","gists_url":"https://api.github.com/users/MarianoPinto/gists{/gist_id}","starred_url":"https://api.github.com/users/MarianoPinto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarianoPinto/subscriptions","organizations_url":"https://api.github.com/users/MarianoPinto/orgs","repos_url":"https://api.github.com/users/MarianoPinto/repos","events_url":"https://api.github.com/users/MarianoPinto/events{/privacy}","received_events_url":"https://api.github.com/users/MarianoPinto/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-04T15:21:46Z","updated_at":"2016-05-04T15:21:46Z","closed_at":null,"body":"Hi everyone,\r\n\r\nI am trying  to launch my test by running \"karma start\" into the terminal but I haven't been able to do it so far because of thousands of errors that are driving me crazy. This is the module with related controller and directive that I would like to test:\r\n\r\n` angular.module('main',[])\r\n\r\n.controller('mainCtrl', function ($scope, $state, States, srvGlobalData ) {\r\n        if (!srvGlobalData.userData.loggedUser)\r\n            $state.go(States.login);\r\n\r\n    })\r\n\r\n.directive('main', function () {\r\n        return {\r\n            restrict: 'E',\r\n            controller: 'mainCtrl',\r\n            templateUrl: '/resources/templates/start.html'\r\n        }\r\n    }); `\r\n\r\nAnd this is the rest I have been trying to launch:\r\n\r\n`\r\ndescribe(\"Trying hard to test Controller\", function (){\r\n\r\n    var $rootScope,\r\n        $scope,\r\n        controller;\r\n\r\n    beforeEach(function(){\r\n\r\n        module(\"main\");\r\n\r\n        inject(function($injector, $state){\r\n\r\n            $rootScope = $injector.get('$rootScope');\r\n            $scope = $rootScope.$new();\r\n            controller = $injector.get('$controller')('mainCtrl',\r\n                {$scope: $scope,\r\n                 $state: $state,\r\n                 States: States,\r\n                 srvGlobalData: srvGlobalData\r\n\r\n            });\r\n        });\r\n    });\r\n\r\n    describe(\"Let's start with unit tests\", function(){\r\n\r\n        it(\"first test\", function(){\r\n            expect(1+1).toEqual(2);\r\n        });\r\n\r\n    });\r\n});`\r\n\r\nFind attached my Karma.conf.js as well:\r\n\r\n`// Karma configuration\r\n// Generated on Wed May 04 2016 10:14:45 GMT+0200 (ora legale Europa occidentale)\r\n\r\nmodule.exports = function(config) {\r\n  config.set({\r\n\r\n    // base path that will be used to resolve all patterns (eg. files, exclude)\r\n    basePath: '',\r\n\r\n\r\n    // frameworks to use\r\n    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter\r\n    frameworks: ['jasmine'],\r\n\r\n\r\n    // list of files / patterns to load in the browser\r\n    files: [\r\n        \r\n\r\n        'app/libs/angular/angular.js',\r\n        'node_modules/angular-mocks/angular-mocks.js',\r\n        'node_modules/angular-resource/angular-resource.min.js',\r\n        'public/Web/libs/angular-ui-router.min.js',\r\n        'app/assets/**/*.js',\r\n        'app/libs/ng-file-upload.js',\r\n        'app/resources/scripts/*.js',\r\n       \r\n        'test/**/*.js'\r\n\r\n    ],\r\n\r\n\r\n    // list of files to exclude\r\n    exclude: [\r\n    ],\r\n\r\n\r\n    // preprocess matching files before serving them to the browser\r\n    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor\r\n    preprocessors: {\r\n    },\r\n\r\n\r\n    // test results reporter to use\r\n    // possible values: 'dots', 'progress'\r\n    // available reporters: https://npmjs.org/browse/keyword/karma-reporter\r\n    reporters: ['progress'],\r\n\r\n\r\n    // web server port\r\n    port: 9876,\r\n\r\n\r\n    // enable / disable colors in the output (reporters and logs)\r\n    colors: true,\r\n\r\n\r\n    // level of logging\r\n    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG\r\n    logLevel: config.LOG_INFO,\r\n\r\n\r\n    // enable / disable watching file and executing tests whenever any file changes\r\n    autoWatch: true,\r\n\r\n\r\n    // start these browsers\r\n    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher\r\n    browsers: ['Chrome'],\r\n\r\n\r\n    // Continuous Integration mode\r\n    // if true, Karma captures browsers, runs the tests and exits\r\n    singleRun: true,\r\n\r\n    // Concurrency level\r\n    // how many browser should be started simultaneous\r\n    concurrency: Infinity\r\n  })\r\n}\r\n`\r\n\r\n\r\n\r\n"}}