Skip to content
This repository has been archived by the owner on Dec 28, 2023. It is now read-only.

dependency issues #71

Closed
boneskull opened this issue Jul 12, 2015 · 4 comments
Closed

dependency issues #71

boneskull opened this issue Jul 12, 2015 · 4 comments

Comments

@boneskull
Copy link
Contributor

Hi,

I'm exploring using karma-mocha for testing Mocha itself. I'm concerned about peerDependencies. With npm v3, an unmet peer dep will result in a warning only. This is fine, but until npm v3 becomes more commonly used, if karma-mocha becomes a dev dep of mocha, it's pointless for Mocha to npm install itself.

(This will also potentially cause problems with forks of Mocha that do various weird things, but I don't know if anyone's complained about that.)

How does the karma-runner org plan on handling the peerDependencies issue? Perhaps it's prudent to remove peerDependencies altogether and note that mocha should be installed within README.md?

As discussed in qunitjs/js-reporters#1, the event names which Mocha emits will eventually change. Requiring version * of Mocha may be dangerous.

@dignifiedquire
Copy link
Member

Hey,

happy to hear you are considering using karma to test mocha :)

To be honest I'm not a big fan of peerDependencies in general, especially in npm@2. We had a lot if issues with them in development as we use it for specifying the karma version. With npm@3 they are much better I think.
As for what to do now, I would like to keep moch as a peerDependency, mostly for consistency woth other karma plugins and hope npm@3 gets adopted quickly.

For using it in mocha I would suggest having an afterInstall step that deleted node_modules/mocha and symlinks it to ../ so that karma-mocha uses the actual moch version. We do the same thing at the moment on the karma main repo to work around the auto install of peerDependencies.
Would that work for you?

We should change that * dependency to be a bit more restrictive to avoid issues with api changes you are right there.

@boneskull
Copy link
Contributor Author

Currently npm v3 throws a max call stack exception if a package is symlinked to itself. I'm not sure if that's a real bug; at the very least they should have a friendlier error message. I'll inquire over there.

@maksimr
Copy link
Contributor

maksimr commented Nov 13, 2015

@boneskull

With npm v3, an unmet peer dep will result in a warning only.

I think warning better than README.md. Users don't read README. For testing mocha you can manually link mocha as node_module in mocha directory.

Thanks

@maksimr
Copy link
Contributor

maksimr commented Nov 7, 2016

Already fixed in this PR

@maksimr maksimr closed this as completed Nov 7, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants