Wow. this was very surprising !
I spent the weekend setting up a little prototype app in Meteor, and I wanted to run some tests on it. It was hooked up to a mongodb instance on compose.io, and linked via MONGO_URL as usual.
So, following along the docs here
“When your app is run in test mode, it is initialized with a clean test database.”
“As we’ve placed the code above in a test file, it will not load in normal development or production mode (which would be an incredibly bad thing!).”
I followed the instructions exactly, putting a call to xolvio’s resetDatabase in a file called “myMethods.spec.js”, and running it with
meteor test --driver-package practicalmeteor:mocha
Wasn’t I surprised to find, after a bit of confusion, that all the collections on my Mongodb (production) instance were now… EMPTY !
What on earth is going on here ?! Am I missing something ? By calling
I had understood this would absolutely not touch the database at MONGO_URL… is this not correct ?