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

Feature request: Ability to declare beforeEach etc. handlers independent of interface #448

Closed
joliss opened this issue Jun 4, 2012 · 2 comments

Comments

@joliss
Copy link
Contributor

joliss commented Jun 4, 2012

In Konacha, which allows you to run Mocha in Rails apps, we need to set up a beforeEach callback (code). Right now this is done by calling beforeEach. But this requires that the 'bdd' interface is used.

This means that Konacha users cannot pick a different interface, because then the beforeEach handler doesn't work anymore.

Instead of adding support for all interfaces to Konacha, I would like to suggest that there could be a simple unified API under the mocha namespace, which would work regardless of the interface chosen. Perhaps all interfaces could actually be implemented using this API.

What do you think?

@tj
Copy link
Contributor

tj commented Jun 4, 2012

sounds reasonable to me, what we need then is a better way to expose the suites, because this already exists (suites[0].beforeEach(fn);) is the impl of beforeEach for the BDD interface for example

@joliss
Copy link
Contributor Author

joliss commented Jun 7, 2012

Right. That sounds great!

@tj tj closed this as completed in 2952bee Jun 18, 2012
TooTallNate pushed a commit to TooTallNate/mocha that referenced this issue Jun 19, 2012
Export top-level suite on global mocha object (mocha.suite). Closes mochajs#448
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