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

QUnit-Mocha-UI need not depend on Mocha #6

Closed
moll opened this issue May 17, 2013 · 4 comments
Closed

QUnit-Mocha-UI need not depend on Mocha #6

moll opened this issue May 17, 2013 · 4 comments

Comments

@moll
Copy link
Contributor

moll commented May 17, 2013

The package.json lists mocha as a dependency, but in reality it's merely for extending the caller's Mocha and not using the one that comes with QUnit-Mocha-UI at all. Currently the extra copy of Mocha is just wasting disk space.

There are also two unnecessary Mocha and Suite assignments at the top of qunit-mocha-ui.js.

If anything, it should more be a runtime dependency in this context, but I don't think NPM supports those...

@itaylor
Copy link
Owner

itaylor commented May 22, 2013

The reference to Mocha.Suite is used on line 83 in qunit-mocha-ui.js to create new suites, and the reference to Mocha.Test is used on line 187. There's no way (that I know of) for me to get a reference to these objects other than to require them.

Really, what should probably happen is that the caller's mocha should pass an instance of itself to the constructor function of the interface. That way it would be runtime dependency only, and I could get rid of the npm dependency on Mocha.

@itaylor itaylor closed this as completed May 22, 2013
@moll
Copy link
Contributor Author

moll commented May 22, 2013

You might want to look at peerDependencies in package.json and module.parent.require. Using another Mocha version's classes for the parent test run will likely break and is wrong anyways.

A.

On 22/05/2013, at 10:08 AM, Ian Taylor notifications@github.com wrote:

The reference to Mocha.Suite is used on line 83 in qunit-mocha-ui.js to create new suites, and the reference to Mocha.Test is used on line 187. There's no way (that I know of) for me to get a reference to these objects other than to require them.

Really, what should probably happen is that the caller's mocha should pass an instance of itself to the constructor function of the interface. That way it would be runtime dependency only, and I could get rid of the npm dependency on Mocha.


Reply to this email directly or view it on GitHub.

@itaylor
Copy link
Owner

itaylor commented May 22, 2013

Yeah, module.parent.require and peerDependencies will probably work. It looks like peerDependencies hasn't made it into the npm docs yet, it's not in https://npmjs.org/doc/json.html. I'll give it a try and see how it goes. I think I'll also need to leave it in the devDependencies section to run the tests, as testrunner.js relies on it.

@itaylor itaylor reopened this May 22, 2013
@moll
Copy link
Contributor Author

moll commented May 22, 2013

Seems so. There's also this blog post: http://domenic.me/2013/02/08/peer-dependencies/
Yeah, Mocha in devDependencies needs to remain as that's for... development. :)

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

No branches or pull requests

2 participants