如何解决我的发电机角项目,以便测试咕噜工作? [英] How do I fix my generator-angular project so that grunt test works?

查看:106
本文介绍了如何解决我的发电机角项目,以便测试咕噜工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作了本教程:<一href=\"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/如要了解创建哪些文件使用的方法哟发电机棱角分明。

I am working off of this tutorial: http://www.sitepoint.com/kickstart-your-angularjs-development-with-yeoman-grunt-and-bower/ as a means to understand what files are created using yo generator-angular.

我在使用AngularJS经验,但一直在寻找一种方式来获得一个最佳实践目录设置;我不知道如何建立依赖关系并获取噶我自己的运行,因此使用自耕农发生器。

I have experience using AngularJS, but was looking for a way to get a best-practices directory set up; I am not sure how to set up dependencies and get karma running on my own, hence using the yeoman generator.

然而,直开箱即用,无需其他任何编辑,当我运行测试的呼噜声,我得到如下:

However, straight out of the box, without editing anything else, when I run grunt test I get the following:

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和更新节点的问题?

I don't understand why jasmine has no provider, and not sure how to go about resolving this issue. is it a matter of fixing my package.json files and updating node?

编辑:这里是配置文件:

Here is the config file:

// 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
  });

};

推荐答案

我似乎已经固定我的问题,对于类似的问题的人:

I seem to have fixed my problem, for anyone with a similar problem:

在我的karma.conf.js我增加了以下内容:

Within my karma.conf.js I added the following:

plugins: [
    'karma-chrome-launcher',
    'karma-jasmine'
    ],

起初我还增加了卡玛 - 茉莉,但当时见了无法加载铬,它未注册!这是通过将业力 - 铬 - 发射'作为解决插件

At first I added 'karma-jasmine' but was then met with "Can not load "Chrome", it is not registered!" This was solved by adding 'karma-chrome-launcher' as a plug-in

不知道是我的错,还是发电机角是过时的,但现在的工作。

Not sure if it was my fault or whether generator-angular is out of date, but it is now working.

这篇关于如何解决我的发电机角项目,以便测试咕噜工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆