sakthivel
sakthivel

Reputation: 96

How to setup karma config in Node js + Jasmine

I am using express for nodeJS. I have written unit test case using jasmine framework. How to generate the code coverage report using karma with Istanbul reporter.

Upvotes: 0

Views: 359

Answers (1)

ronapelbaum
ronapelbaum

Reputation: 1797

If your codebase is node, so you can simply run jasmine as your test runner:

jasmine src/**/*.spec.js

now just add istanbul:

istanbul cover jasmine src/**/*.spec.js

a simple configuration for istanbul should be in .istanbul.yml:

instrumentation:
    excludes: [
      "**/*.spec.js"
    ]
reporting:
  reports:
    - lcov
    - json-summary
    - html
check:
  global:
    statements: 95
    branches: 95
    functions: 95
    lines: 95

Upvotes: 1

Related Questions