Ember CLI代码覆盖率报告 [英] Ember CLI Code Coverage Reports

查看:173
本文介绍了Ember CLI代码覆盖率报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Ember CLI,我正在尝试将代码覆盖率报告与使用testem运行的内置Qunit测试进行集成。我试图使用伊斯坦布尔,但是我无法找到文件来查找文件,因为它似乎在tmp目录中。我试图在我的testem.json中这样做:

  {
framework:qunit,
serve_files:[
instrumented / components / *。js
],
before_tests:istanbul instrument - output instrumented / components app / components,
aftertests:istanbul report,
test_page:tests / index.html,
launch_in_ci:[PhantomJS],
launch_in_dev PhantomJS,Chrome],
记者:点击
}

但是我一直收到错误:
not ok 1错误
---
消息:>

  fs.js:684 
return binding.stat(pathModule._makeLong(path));
^
错误:ENOENT,没有这样的文件或目录'/Users/Robert/ui/tmp/class-tests_dist-hqZLfsWS.tmp/app/components'
在Object.fs.statSync (fs.js:684:18)
在InstrumentCommand.Command.mix.run(/usr/local/lib/node_modules/istanbul/lib/command/instrument.js:230:20)
at runCommand(/usr/local/lib/node_modules/istanbul/lib/cli.js:58:19)
在runToCompletion(/usr/local/lib/node_modules/istanbul/lib/cli.js:62:5) )
在Object。< anonymous> (/usr/local/lib/node_modules/istanbul/lib/cli.js:67:5)
在Module._compile(module.js:456:26)
在Object.Module._extensions。 .js(module.js:474:10)
在Module.load(module.js:356:32)
在Function.Module._load(module.js:312:12)
在Function.Module.runMain(module.js:497:10)

我尝试使用Karma as好的,但我无法弄清楚配置。我也尝试了一下毯子,但是这只是给了我一个100%的错误的报告,被覆盖的代码。



我不完全明白如何使用泛型代码,我不知道最好的方法是什么,但我一定会喜欢任何帮助,指出我正确的方向如何获得一个很好的代码覆盖率报告。



有没有人成功地集成了任何类型的代码覆盖率报告?

解决方案

现在有一个新的Ember插件用于代码覆盖与伊斯坦布尔Ember-CLI-Blanket不再工作。



您可以在这里找到新的插件:
https://github.com/kategengler/ember-cli-code-coverage


I am using Ember CLI and I am trying to integrate code coverage reports with the built in Qunit tests that are run with testem. I tried to use Istanbul, but I couldn't get it to find the files to instrument because it seems to be looking in the tmp directory. I tried doing this in my testem.json:

{
"framework": "qunit",
"serve_files": [
    "instrumented/components/*.js"
],
"before_tests": "istanbul instrument --output instrumented/components app/components",
"after_tests": "istanbul report",
"test_page": "tests/index.html",
"launch_in_ci": ["PhantomJS"],
"launch_in_dev": ["PhantomJS", "Chrome"],
"reporter": "tap"
}

But I kept getting errors like this: not ok 1 Error --- message: >

        fs.js:684
          return binding.stat(pathModule._makeLong(path));
                         ^
        Error: ENOENT, no such file or directory '/Users/Robert/ui/tmp/class-tests_dist-hqZLfsWS.tmp/app/components'
            at Object.fs.statSync (fs.js:684:18)
            at InstrumentCommand.Command.mix.run (/usr/local/lib/node_modules/istanbul/lib/command/instrument.js:230:20)
            at runCommand (/usr/local/lib/node_modules/istanbul/lib/cli.js:58:19)
            at runToCompletion (/usr/local/lib/node_modules/istanbul/lib/cli.js:62:5)
            at Object.<anonymous> (/usr/local/lib/node_modules/istanbul/lib/cli.js:67:5)
            at Module._compile (module.js:456:26)
            at Object.Module._extensions..js (module.js:474:10)
            at Module.load (module.js:356:32)
            at Function.Module._load (module.js:312:12)
            at Function.Module.runMain (module.js:497:10)

I tried using Karma as well, but I couldn't figure out the configuration. I also tried blanket, but that just gave me a false report of 100% covered on the transpiled code.

I don't fully understand how the transpiled code works, and I'm not sure what the best way to approach this is, but I would definitely love any help to point me in the right direction for how to get a nice code coverage report.

Has anyone successfully integrated any code coverage reports of any kind?

解决方案

There is now a new Ember addon for code coverage with Istanbul. Ember-CLI-Blanket no longer works.

You can find the new addon here: https://github.com/kategengler/ember-cli-code-coverage

这篇关于Ember CLI代码覆盖率报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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