Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

Make the setup automatic and without requiring mocha to be initialized #6

Open
TazmanianD opened this issue Aug 30, 2017 · 0 comments

Comments

@TazmanianD
Copy link

To use f-mocha you have to import the module and explicitly call setup and this has to be done inside of at least one of the test cases. If you look at how co-mocha achieves the same thing, they do it in a way where no explicit setup is required and it has the benefit that this can be done before mocha is initialized.

We run our tests and have a --require in our mocha.opts file that loads a test initialization file anytime a test is executed without having to repeat that initialization in every test. This is where we put the initialization call to co-mocha. If I put your setup call for f-mocha in that code it fails because mocha hasn't initialized yet and the functions you are looking for do not yet exist in the global namespace. The co-mocha library seems to have found a way around that (https://github.com/blakeembrey/co-mocha/blob/master/lib/co-mocha.js#L53).

An alternative to consider.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant