Skip to content

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

Open
andrewiggins wants to merge 5 commits into
developit:masterfrom
andrewiggins:fix-custom-config-coverage
Open

Add coverage as a separate babel loader if loaders already exist#63
andrewiggins wants to merge 5 commits into
developit:masterfrom
andrewiggins:fix-custom-config-coverage

Conversation

@andrewiggins

Copy link
Copy Markdown
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.

Comment thread src/webpack.js
// 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

2 participants