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

Expose only the specified UI in the browser #984

Merged
merged 1 commit into from
Dec 6, 2013

Conversation

jugglinmike
Copy link
Contributor

I'm happy to add tests for this, but it doesn't look like there are any tests for the browser build--is this the case?

Commit message:

When instantiated in the browser, Mocha registers the "BDD-style"
interface. Since an explicit call to the browser-specific mocha.ui is
required, the original registration is invalid. Prevent that UI from
reacting to the pre-require event (and exposing its API).

When instantiated in the browser, Mocha registers the "BDD-style"
interface. Since an explicit call to the browser-specific `mocha.ui` is
required, the original registration is invalid. Prevent that UI from
reacting to the `pre-require` event (and exposing its API).
@jugglinmike
Copy link
Contributor Author

@visionmedia Does this look okay to you? Is there anything else I can do to help get it merged?

@jugglinmike
Copy link
Contributor Author

@travisjeffery Looks like TJ's a little busy. Would you mind reviewing this?

@travisjeffery
Copy link
Contributor

it's not clear why's this change is needed?

@jugglinmike
Copy link
Contributor Author

If you run Mocha in the browser today, it will always expose the BDD style interface.

For example, in an environment that states: mocha.setup({ ui: 'tdd' });, the describe and it functions will be defined globally in addition to the suite and test functions.

@travisjeffery
Copy link
Contributor

just tested this by switching this line https://github.com/visionmedia/mocha/blob/master/test/browser/index.html#L8 to use the tdd interface and describe wasn't defined.

@jugglinmike
Copy link
Contributor Author

@travisjeffery That is the intent of this pull request. When you specify the "tdd" interface, describe should not be defined.

travisjeffery added a commit that referenced this pull request Dec 6, 2013
Expose only the specified UI in the browser

* jugglinmike/browser-ui:
  Expose only the specified UI in the browser
@travisjeffery travisjeffery merged commit 2c8aa0a into mochajs:master Dec 6, 2013
@travisjeffery
Copy link
Contributor

no i knew the intent, i thought i was testing it without your change and still seeing that expected behavior. all good now

@jugglinmike
Copy link
Contributor Author

Ah, I see. Thanks for reviewing!

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.

2 participants