jasmine with jscoverage automated testing

code-coverage, continuous-integration, unit-testing

Solution

If you're working on a ruby project and using jasmine via jasmine-gem, I have a patch that adds jscoverage support[1].

If you're using bundler, you can use this version of jasmine with the following command in your `Gemfile`:

  gem 'jasmine',
    :git        => 'git://github.com/hjdivad/jasmine-gem',
    :submodules => true,
    :branch     => 'jscoverage'

Make sure you've downloaded jscoverage and it's in your `$PATH`.

You can then add the following to `jasmine.yml`

coverage:
  enabled:    true
  encoding:   utf-8
  tmp_dir:    tmp
  report_dir: public/coverage
  skip_paths:
    - public/javascripts/vendor

If this works for you, you may want to speak up on the pull request[2] to get it, or some variation, into jasmine-gem proper.

- [1] https://github.com/hjdivad/jasmine-gem/tree/jscoverage

- [2] https://github.com/pivotal/jasmine-gem/pull/37

Problem

Had been looking at the jsunit and jcoverage demos here (click on coverage report link. Open this in a new tab). I was wondering if any one had done anything similar with Jasmine and JSCoverage ? I'm a little unsure on how to proceed. [EDIT] I am wondering if there is something I can do with a jasmine reporter. My Jasmine "hello world" example makes reference to a TrivialReporter. Maybe this can be extended ?? [EDIT] I've wired up js-test-runner with jasmine right now. Now If I could think of a way to get coverage ??

Original source