我正在学习本教程:http://www.sitepoint.com/kickstart-your-angularjs-development-with-yeoman-grunt-and-bower/ http://www.sitepoint.com/kickstart-your-angularjs-development-with-yeoman-grunt-and-bower/作为了解使用 yo Generator-Angular 创建哪些文件的方法。
我有使用 AngularJS 的经验,但正在寻找一种方法来设置最佳实践目录;我不确定如何设置依赖项并让 karma 自行运行,因此使用 yeoman 生成器。
然而,直接开箱即用,无需编辑任何其他内容,当我运行 grunt test 时,我得到以下结果:
running "clean:server" (clean) task
Cleaning .tmp...OK
Running "concurrent:test" (concurrent) task
Running "copy:styles" (copy) task
Copied 1 files
Done, without errors
Running "autoprefixer:dist" (autoprefixer) task
Prefixed file ".tmp/styles/main.css" created.
Running "connect:test" (connect) task
Started connect web server on 127.0..0.1:9001.
Running "karma:unit" (karma) task
Warning: No provider for "framework:jasmine"! (resolving: framework:jasmine) Use --force to continue.
Aborted due to warnings.
我不明白为什么茉莉花没有提供者,也不知道如何解决这个问题。这是修复我的 package.json 文件并更新节点的问题吗?
编辑:这是配置文件:
// Karma configuration
// http://karma-runner.github.io/0.10/config/configuration-file.html
module.exports = function(config) {
config.set({
// base path, that will be used to resolve files and exclude
basePath: '',
// testing framework to use (jasmine/mocha/qunit/...)
frameworks:['jasmine'],
// list of files / patterns to load in the browser
files: [
'app/bower_components/angular/angular.js',
'app/bower_components/angular-mocks/angular-mocks.js',
'app/bower_components/angular-resource/angular-resource.js',
'app/scripts/*.js',
'app/scripts/**/*.js',
'test/mock/**/*.js',
'test/spec/**/*.js'
],
// list of files / patterns to exclude
exclude: [],
// web server port
port: 8080,
// level of logging
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: ['Chrome'],
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false
});
};