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

Adds ability to load external interfaces #851

Closed
wants to merge 1 commit into from

Conversation

itaylor
Copy link

@itaylor itaylor commented May 17, 2013

This adds support for loading additional interfaces with the --ui option, similar to how the --reporter option works.

After this commit, you should be able use an alternate interface like this:
npm install someMochaUI
mocha --ui someMochaUI path/to/a/mochatest.js

…ui option, similar to how the --reporter option works.

You should be able use an alternate interface like this:
npm install someMochaUI
mocha --ui someMochaUI path/to/a/mochatest.js
@andreypopp
Copy link
Contributor

Can we have it merged? I want to use a custom interface which wraps it blocks in fibers. mocha --require ./fiber-ui --ui fiber-ui doesn't work (I update mocha.interfaces inside ./fiber-ui.js but it seems to get the wrong instance of mocha module).

@andreypopp
Copy link
Contributor

Not sure though if it should mutate exports.interfaces global, maybe just setting this._ui?

@itaylor
Copy link
Author

itaylor commented Nov 2, 2013

I managed to work around the lack of this feature by making sure that I got the right instance of the Mocha object. I did this by marking it in the peerDependencies instead of dependencies in package.json then grabbing the Mocha instance from module.parent.require

That allowed me to add my interface in to the running instance of mocha.
Here's a commit that illustrates doing this. itaylor/qunit-mocha-ui@125201c

After that change I was able to add a new interface to the Mocha.interfaces object, and it was there in the testrunner's Mocha instance.

I hope that helps you out some, although it'd be a lot easier this feature would get merged, though.

@andreypopp
Copy link
Contributor

@itaylor see #1022 — it appears requires processed after setting an UI so even if I get right mocha instance this won't work

@travisjeffery
Copy link
Contributor

gonna go with #1022

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

Successfully merging this pull request may close these issues.

3 participants