为什么我在开始测试时出现错误?

时间:2014-10-16 12:56:32

标签: javascript node.js angularjs unit-testing intellij-idea

比我添加这个:

beforeEach(module('tabQuestionsApp'));

在derictive测试中我有一个错误:

" C:\ Program Files \ nodejs \ node.exe" C:\ Users \ tek.WebIde80 \ config \ plugins \ js-karma \ js_reporter \ karma-intellij \ lib \ intellijRunner.js --karmaPackageDir = C:\ Users \ tek \ AppData \ Roaming \ npm \ node_modules \ karma - serverPort = 8080 --urlRoot = /

minErr /< @D:/OpenServer/domains/project/web/js/appcrm/tab_questions/app/scripts/resources/angular/angular.js:78:12 loadModules /< @D:/OpenServer/domains/project/web/js/appcrm/tab_questions/app/scripts/resources/angular/angular.js:3906:15 的forEach @ d:/OpenServer/domains/project/web/js/appcrm/tab_questions/app/scripts/resources/angular/angular.js:325:9 loadModules @ d:/OpenServer/domains/project/web/js/appcrm/tab_questions/app/scripts/resources/angular/angular.js:3872:5 createInjector @ d:/OpenServer/domains/project/web/js/appcrm/tab_questions/app/scripts/resources/angular/angular.js:3812:11 workFn @ d:/OpenServer/domains/project/web/js/appcrm/tab_questions/app/scripts/resources/angular-mocks/angular-mocks.js:2244:46

处理完成,退出代码为0

我的应用 - 初始化:

angular.module('tabQuestionsApp', ['ngSelectable','angularFileUpload','ngCkeditor','ngSanitize']);

业力包含文件:

files: [
  'app/scripts/resources/ng-file-upload-shim/angular-file-upload-shim.min.js',
  'app/scripts/resources/angular/angular.js',
  'app/scripts/resources/angular-mocks/angular-mocks.js',
  'app/scripts/resources/ng-file-upload/angular-file-upload.min.js',
  'app/scripts/resources/ng-ckeditor/ng-ckeditor.js',
  'app/scripts/resources/angular-sanitize/angular-sanitize.js',
  'app/scripts/resources/lodash/dist/lodash.js',
  'app/scripts/resources/ngSelectable/src/ngSelectable.js',
  'app/views/*.html',
  'app/scripts/app.js',
  'app/scripts/directives/tagSearch.js',
  'test/spec/directives/tagSearch.js'

     ],

1 个答案:

答案 0 :(得分:0)

您需要将函数作为参数传递给beforeEach

beforeEach(function(){
    module('yourModuleName');
})