Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add coverage as a separate babel loader if loaders already exist #63

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

andrewiggins
Copy link
Collaborator

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.

@@ -115,21 +133,7 @@ export function addWebpackConfig(karmaConfig, pkg, options) {
// devtool: 'module-source-map',
mode: webpackConfig.mode || 'development',
module: {
// @TODO check webpack version and use loaders VS rules as the key here appropriately:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this TODO is handled by line 180 below so I removed it

@developit
Copy link
Owner

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?

@andrewiggins
Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants