douglasduteil / isparta

:skull: A code coverage tool for ES6 (babel/6to5)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Working demo with babel6 + karma

fernandofleury opened this issue · comments

I've bumping my head to make proper babel6 code coverage using isparta + karma.

Right now this is the error I get from it:

Post-processing using source maps Nothing mapped from file:

My karma config:

coverageReporter: {
      instrumenters: {
        isparta : require('isparta')
      },
      instrumenter: {
        '*.js': 'isparta'
      }
    },
babelPreprocessor: {
      options: {
        sourceMap: 'inline'
      }
    },

Same here, without karma. I just get No coverage information was collected, exit without writing coverage information with no other information or error output.

As in right now, I can generate a pseudo babel6 coverage:

image

As you can see, the generated coverage is not properly formatted. It's still covering es5 code.

This is my example of generating es6 coverage report with karma + karma-browserify + isparta(v4).
https://github.com/kt3k/karma-browserify-isparta-example
https://codecov.io/github/kt3k/karma-browserify-isparta-example?branch=master

@kt3k That's a pretty clever ideia. I've managed to make it work as well!

Currently istanbul's official babel-plugin-istanbul can instrument es6 code. I think that is now the most reliable way to create coverage report of es6 scripts.