I get an error --- Error: [$injector:nomod] http://errors.angularjs.org/1.3.15/$injector/nomod?p0=decisionTree when I run karma.cong.js in Webstorm
I get an error --- Error: [$injector:nomod] http://errors.angularjs.org/1.3.15/$injector/nomod?p0=decisionTree when I run karma.cong.js in Webstorm
这是我的 karma.conf.js 文件
module.exports = function(config) {
var configuration = {
basePath : '',
autoWatch : false,
frameworks: ['jasmine'],
files: [
'bower_components/angular/angular.min.js',
'bower_components/angular-mocks/angular-mocks.js',
'bower_components/angular-resource/angular-resource.min.js',
'bower_components/angular-animate/angular-animate.min.js',
'bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js',
'bower_components/angular-cookies/angular-cookies.min.js',
'bower_components/angular-sanitize/angular-sanitize.min.js',
'bower_components/angular-touch/angular-touch.min.js',
'bower_components/angular-ui-router/release/angular-ui-router.min.js',
'src/app/**/*.js'
],
ngHtml2JsPreprocessor: {
stripPrefix: 'src/',
moduleName: 'gulpAngular'
},
browsers : ['PhantomJS'],
plugins : [
'karma-phantomjs-launcher',
'karma-jasmine',
'karma-ng-html2js-preprocessor'
],
preprocessors: {
'src/**/*.html': ['ng-html2js']
}
};
config.set(configuration);
};
今天在stackover上找了一个下午这样的问题,还是没找到解决办法。
请问谁能解决这个问题
似乎您的规范是在应用程序文件之前加载的,您的 angular 模块无法解析。请尝试按如下方式更改“files
”:
files: [
'bower_components/jquery/dist/jquery.js',
'bower_components/angular/angular.js',
'bower_components/angular-animate/angular-animate.js',
'bower_components/angular-cookies/angular-cookies.js',
'bower_components/angular-touch/angular-touch.js',
'bower_components/angular-sanitize/angular-sanitize.js',
'bower_components/angular-resource/angular-resource.js',
'bower_components/angular-ui-router/release/angular-ui-router.js',
'bower_components/angular-bootstrap/ui-bootstrap-tpls.js',
'bower_components/angular-mocks/angular-mocks.js',
'src/app/index.js',
'src/app/main/main.controller.js',
'src/app/components/navbar/navbar.controller.js',
'src/**/*.html',
'src/**/*.spec.js',
'src/**/*.mock.js'
],
karma 测试 运行 以这种方式更改配置后对我来说很好
这是我的 karma.conf.js 文件
module.exports = function(config) {
var configuration = {
basePath : '',
autoWatch : false,
frameworks: ['jasmine'],
files: [
'bower_components/angular/angular.min.js',
'bower_components/angular-mocks/angular-mocks.js',
'bower_components/angular-resource/angular-resource.min.js',
'bower_components/angular-animate/angular-animate.min.js',
'bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js',
'bower_components/angular-cookies/angular-cookies.min.js',
'bower_components/angular-sanitize/angular-sanitize.min.js',
'bower_components/angular-touch/angular-touch.min.js',
'bower_components/angular-ui-router/release/angular-ui-router.min.js',
'src/app/**/*.js'
],
ngHtml2JsPreprocessor: {
stripPrefix: 'src/',
moduleName: 'gulpAngular'
},
browsers : ['PhantomJS'],
plugins : [
'karma-phantomjs-launcher',
'karma-jasmine',
'karma-ng-html2js-preprocessor'
],
preprocessors: {
'src/**/*.html': ['ng-html2js']
}
};
config.set(configuration);
};
今天在stackover上找了一个下午这样的问题,还是没找到解决办法。 请问谁能解决这个问题
似乎您的规范是在应用程序文件之前加载的,您的 angular 模块无法解析。请尝试按如下方式更改“files
”:
files: [
'bower_components/jquery/dist/jquery.js',
'bower_components/angular/angular.js',
'bower_components/angular-animate/angular-animate.js',
'bower_components/angular-cookies/angular-cookies.js',
'bower_components/angular-touch/angular-touch.js',
'bower_components/angular-sanitize/angular-sanitize.js',
'bower_components/angular-resource/angular-resource.js',
'bower_components/angular-ui-router/release/angular-ui-router.js',
'bower_components/angular-bootstrap/ui-bootstrap-tpls.js',
'bower_components/angular-mocks/angular-mocks.js',
'src/app/index.js',
'src/app/main/main.controller.js',
'src/app/components/navbar/navbar.controller.js',
'src/**/*.html',
'src/**/*.spec.js',
'src/**/*.mock.js'
],
karma 测试 运行 以这种方式更改配置后对我来说很好