-
Notifications
You must be signed in to change notification settings - Fork 95
drop Mocha peer dep? #114
Comments
@boneskull karma should be in peer dependencies too like in karma-jasmine
Yes
Why? Why we should add additional code to karma-mocha if this already implemented in npm? Thanks! |
Because the implementation of peer deps is problematic. There's a reason npm v3 reduced unmet peer deps to a warning. Users of npm v3 would have to FWIW, the code would amount to: try {
require('mocha');
} catch (err) {
throw new Error('karma-mocha requires Mocha; install via "npm install mocha"');
} The point of this ticket is that I can't use |
@boneskull thanks, now I understand your pain but how you will resolve problem with require.resolve('mocha')? |
|
@boneskull ok, I have no reason why we can not remove peer dependency. |
…ner#114 - this is a breaking change and should probably be released as v2.0.0
karma-mocha won't work without Mocha, of course.
But it won't work without Karma, either.
The idea behind peer dependencies is to help support "plugins". karma-mocha is most certainly not a Mocha plugin. So if anything, Karma should be the peer dependency, right?
But a peer dependency is just a static check, really. I'm no big fan of them. Instead of this, what if karma-mocha had a runtime check for a
mocha
package? Maybe it already does?Would you accept a PR that drops the peer dep and/or checks for Mocha at runtime?
(Backstory: Mocha is consuming Karma and karma-mocha to run its own tests. Please see mochajs/mocha#2487 for current state of affairs, and how we're trying to work around this.)
The text was updated successfully, but these errors were encountered: