karmatic icon indicating copy to clipboard operation
karmatic copied to clipboard

Add coverage as a separate babel loader if loaders already exist

Open andrewiggins opened this issue 5 years ago • 2 comments

With the new E2E test suite, I noticed that coverage is not properly reported when the user provides a custom webpack.config.js. This PR fixes that by detecting if webpack loaders exist and if so, adding a new babel-loader with just the coverage plugin enabled.

Our tests also now enforce that coverage is correctly reported for all tests.

andrewiggins avatar Aug 14 '20 00:08 andrewiggins

I wonder if we could inject this into any existing babel-loader present in rules. In the current implementation, each babel-loader config item in Webpack triggers its own complete Babel pass over all modules.

Or maybe something like a .babelrc "override" config?

developit avatar Aug 14 '20 20:08 developit

I took a stab at adding to existing loaders in the latest commit. Does that look right? I also updated the webpack-custom test to use a babel.config.js to double check that setting babel-loader options.plugin is merged with the config file.

andrewiggins avatar Aug 14 '20 23:08 andrewiggins