【问题标题】:Generating a SpecRunner for jasmine using grunt使用 grunt 为茉莉花生成 SpecRunner
【发布时间】:2014-01-24 18:46:42
【问题描述】:

当我添加和删除测试时,我经常需要创建/编辑一个SpecRunner.html 文件。

我知道我可以使用 karma 运行测试服务器。但是对于开发测试,我更喜欢在浏览器中检查结果。我已经尝试过使用 karma,我目前使用 grunt 运行测试;但有时我更喜欢控制台来编写测试。

是否有 yeoman 生成器会在此时自动为我生成 specrunner?

我找到了这个 npm 包:https://npmjs.org/package/atropa-jasmine-spec-runner-generator-html

但它似乎没有得到广泛支持或通过 grunt 运行。

【问题讨论】:

    标签: gruntjs jasmine


    【解决方案1】:

    grunt-template-jasmine-requirejs 是 Angular/Backbone 项目的不错选择。它旨在与 grunt-contrib-jasmine 一起使用,但它会使用 grunt 为您即时生成规范运行器 html 文件。

    在 gruntfile 中指定输出

    jasmine:{
       template: require('grunt-template-jasmine-requirejs'),
       templateOptions: {
           requireConfigFile: 'src/test/js/require-unit-config.js'
       },
       test:{
           options:{
             outfile:'mySpecRunner.html'
           }
       }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-12-12
      • 1970-01-01
      • 1970-01-01
      • 2023-03-11
      • 2015-07-26
      • 1970-01-01
      • 2023-03-23
      • 1970-01-01
      相关资源
      最近更新 更多