douglasduteil / isparta

:skull: A code coverage tool for ES6 (babel/6to5)
Do What The F*ck You Want To Public License
642 stars 47 forks source link

Working demo with babel6 + karma #104

Closed fernandofleury closed 7 years ago

fernandofleury commented 8 years ago

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'
      }
    },
trodrigues commented 8 years ago

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

fernandofleury commented 8 years ago

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.

kt3k commented 8 years ago

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

fernandofleury commented 8 years ago

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

kt3k commented 7 years ago

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.