Ember CLI Code Coverage Reports
Asked Answered
O

2

17

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?

Odont answered 30/6, 2014 at 16:32 Comment(1)
give it a hack path ../../app/components, if this helps i will post it as an answer.Protest
O
3

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

Odont answered 26/7, 2016 at 15:14 Comment(0)
R
3

Steven Glanzer recently released an ember-cli add-on for providing code coverage called ember-cli-blanket.

You can find it at https://github.com/sglanzer/ember-cli-blanket

Richma answered 4/12, 2014 at 1:13 Comment(0)
O
3

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

Odont answered 26/7, 2016 at 15:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.