thedeeno / web-component-tester-istanbul

Instanbul coverage reporting for projects being tested by web-component-tester
28 stars 29 forks source link

Fixed plugin to use it with web-component-tester version >= 6.4.0. #45

Open angulito opened 6 years ago

angulito commented 6 years ago
212361828 commented 6 years ago

An update to make this plugin work with 6.4 is sorely needed. Is this repo still being maintained?

megheaiulian commented 6 years ago

@AnguloHerrera The PR works fine for a single test suite file. But when you have something like that -> https://github.com/PolymerElements/iron-selector/blob/master/test/index.html and the same file is loaded again code coverage for it isn't updated. The problem is caching. When the same file is loaded again instrumentAsset and/or instrumentHtml no longer calls instrumentSync.

angulito commented 6 years ago

@megheaiulian, is it fixed with those changes? https://github.com/AnguloHerrera/web-component-tester-istanbul/tree/develop

I have updated to set into cache the url plus query params.

I don't remove the cache because if I do it, then it can have problems with the rest petitions and the middleware, because they are intercepted, so the petition must be set into cache if it is the first time that the file is called.

Feel free to do a PR to my repository to fix it.

Thanks.

megheaiulian commented 6 years ago

@AnguloHerrera Fixed it with this commit https://github.com/plumelo/web-component-tester-istanbul/commit/52093bde2ae673a16f606e2c36cd16f253e516fc. When instrumented content is already in cache it should be returned ? The else case of if(!cache[asset]) ?

angulito commented 6 years ago

Ok, thanks @megheaiulian, now it should be fixed 👍

angulito commented 6 years ago

I have uploaded a new npm package with those changes. I hope this PR is merged and that provisional npm package is not needed anymore. https://www.npmjs.com/package/web-component-tester-istanbulcoverage

megheaiulian commented 6 years ago

@AnguloHerrera Thank you. I too hope it gets merged.

kongxiangyan commented 5 years ago

Awesome job !!! Bring me out of confusions after trying almost every method. Thanks too much !