-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
How to setup a global hook for database prefills (fixtures) #110
Comments
I get the same problem.
I've had to fork the repo, add it as a local dependency and manually load the hooks from the |
Another option that I have found, but seems like it goes against the idea of the
It also doesn't seem to allow importing code from within other parts of the project |
I want to prefill my Meteor database once, before all other tests are run. I managed to do this using a global
before()
handler.However, the Mocha docs state that this is not the preferred way. Instead, you should use a root hook plugin instead: https://mochajs.org/#root-hook-plugins
Yet, however I try to set this up, the file is ignored. I tried to define it via
.mocharc.js
(using both CommonJS and ES6 syntax),mochalrc.json
, and an entry inpackage.json
.What is the preferred way to setup such a root hook plugin in Meteor?
Another question in the same context: If I use a global hook, it will work fine for the database. So I tried to use the same mechanism for setting up local collections (
Mongo.Collection(null)
). However this won't work, because every time Meteor recompiles its files due to changes, the hook won't be re-run, and thus the data I add to these local collections won't be initialized. Is there a way to re-run a global hook on every Meteor rebuild?The text was updated successfully, but these errors were encountered: