【问题标题】:How to run Unit test in yeoman如何在 yeoman 中运行单元测试
【发布时间】:2015-02-26 07:18:07
【问题描述】:

我有一个使用grunt的项目的链接:https://github.com/brunoscopelliti/ng-unique/。

如何在这个项目中运行单元测试?

【问题讨论】:

    标签: html angularjs gruntjs yeoman


    【解决方案1】:

    咕噜测试

    应该工作

    您应该使用测试环境配置您的 grunfile,就像您为构建、调试或运行配置一样,以防它未配置,即:

    grunt.registerTask('test', ['env:test', 'mochaTest', 'karma:unit']);

    【讨论】:

      【解决方案2】:

      通过查看Gruntfile.js,您可以看到已注册的任务。

      目前注册了三个任务;

      grunt.registerTask('build-js', ['jshint', 'karma:unit', 'uglify:ngUnique']);
      grunt.registerTask('build-css', ['sass:prod']);
      grunt.registerTask('build-all', ['build-css', 'build-js']);
      

      从源码可以看出,build-js 任务包括运行karma:unit 配置。

      要触发这个注册的任务,你必须运行grunt build-js,或者如果你只想运行Karma配置你必须运行grunt karma:unit。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-09-25
        • 1970-01-01
        • 2017-01-19
        • 2013-02-19
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多