nkbt/esnext-quickstart

Support ES6 classes syntax with working coverage

Closed this issue · 4 comments

nkbt commented

The issue appears in coverage. Everything usually works fine, but coverage is kind of broken because of transpiling:

cgsvyctuqaaazia png_large

There is a solution:

20150606-013726

But it does not fix everything unfortunately:

20150606-013830

nkbt commented

Probably this outstanding branch check could be fixed by adding some additional test for component itself. Will play a bit more with it.

nkbt commented

Hmm, Firefox Dev edition supports Classes syntax if used with

<script type="application/javascript;version=1.7"> (or version=1.8) tag.

http://kangax.github.io/compat-table/es6/#class

So the possible solution could be to use Firefox Dev edition and disable bunch of BabelJS transpiling options, so the code for instrumenter will be coming mostly untouched.

nkbt commented

I tried to avoid extra transformations using babel's blacklist option and Firefox Dev Edition. Import/export is not yet supported anywhere, so I blacklisted only classes. Classes are supported only with <script type="application/javascript;version=1.7"> so I modified karma's internal html.

Another problem was that webpack does not support es6 and gives compilation errors, when it sees class. That could be fixed by using npm install webpack/webpack#webpack-2 branch which uses acorn parser and does not fail horribly anymore.

After all things I still could not get the coverage report, though doing normal webpack compilation worked and Firefox Dev was showing working site as expected.

That does not look like a working solution anyway :(

nkbt commented

Oh, yes! It is solved with https://github.com/deepsweet/isparta-loader

Beautiful

20150616-095442

All fixed with 2e90d07