karma-coverage icon indicating copy to clipboard operation
karma-coverage copied to clipboard

ES6 + Rollup + Karma Coverage

Open flovogt opened this issue 7 years ago • 4 comments

Hi Developers, i am looking for a nice tutorial / example project where Rollup, ES6, Karma and Karma Coverage is used. I try to get the coverage reporting working. Test execution with QUnit and Karma works, only the coverage reporting is not working. Do you any useful links?

flovogt avatar Jan 25 '19 09:01 flovogt

Long time ago. However, here is an example how I got it work https://github.com/flovogt/es6-rollup-karma-coverage

flovogt avatar Jun 17 '20 14:06 flovogt

I was struggling with this too and finally got it to work with a different approach. Now that it's set up, it seems simple/straightforward, but it took longer than I'd like to admit to get the pieces placed correctly.

My solution is up at https://github.com/oyejorge/rollup-karma-coverage

oyejorge avatar Oct 23 '20 00:10 oyejorge

Thanks @oyejorge for sharing your alternative approach.

Only to highlight the difference: Your solution are using the bundled files for test executing in the karma config, isn't it? In the first sample karma uses the source files so no build is needed.

flovogt avatar Oct 23 '20 07:10 flovogt

Right. The build is done as normal with rollup npm run build and doesn't have to be defined inside of karma.conf.js at all.

When running npm test, the build is automatically created first via the pretest entry in package.json.

oyejorge avatar Oct 23 '20 14:10 oyejorge