-
Notifications
You must be signed in to change notification settings - Fork 220
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
fix(mocha-env-loader): add webpack >= v4.0.0
support
#341
Conversation
src/karma-webpack.js
Outdated
@@ -242,7 +242,7 @@ Plugin.prototype.make = function(compilation, callback) { | |||
var entry = file | |||
|
|||
if (this.wrapMocha) { | |||
entry = `${require.resolve('./mocha-env-loader')}!${entry}` | |||
entry = `${require.resolve('./mocha-env-loader')}?name=${compilation.name}!${entry}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be potentially breaking ? It's fine since v4.0.0
is a beta
release, but we need to be aware just in case :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just tested it out and this will need to drop support for anything less than webpack 4 as it turns out webpack-dev-middleware
has.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated peerDependencies
, yeah [email protected]
doesn't work with webpack < v4.0.0
.
src/mocha-env-loader.js
Outdated
@@ -7,8 +7,10 @@ var SourceMapConsumer = sourceMap.SourceMapConsumer | |||
module.exports = function(content, map) { | |||
this.cacheable() | |||
|
|||
var options = loaderUtils.getOptions(this) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to always clone them
var options = Object.assign({}, loaderUtils.getOptions(this))
src/mocha-env-loader.js
Outdated
var sourceNode | ||
var id = this.options.name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
webpack >= v4.0.0
support
…nd fix webpack 4 compatibility Fixes #326
webpack >= v4.0.0
supportwebpack >= v4.0.0
support, drop webpack < v4.0.0
webpack >= v4.0.0
support, drop webpack < v4.0.0
webpack >= v4.0.0
support
https://github.com/webpack-contrib/karma-webpack/releases/tag/v4.0.0-beta.0 already dropped |
webpack >= v4.0.0
supportwebpack >= v4.0.0
support, drop webpack < v4.0.0
webpack >= v4.0.0
support, drop webpack < v4.0.0
webpack >= v4.0.0
support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Released in |
finally helpful error messages on failing execution! 🙌 I was searching for hours why my typescripts tests are not executed when I import certain modules. Now I now: I have to put them in the files array! Thanks folks! 😍 |
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
What is the current behavior?
Currently the loader uses
this.options
, which is deprecated in webpack 4, causing an error.What is the new behavior?
Adds the compilation name to the loader options and uses
loader-utils
to parse the loader context and retrieve the name.Drops
webpack < v4.0.0
support as it doesn't work due towebpack-dev-middleware
not supporting anything less thanv4.0.0
.Does this PR introduce a breaking change?