I added my 1st watcher test and it works fine. Does exactly what is expected.
I'm using MongoMemoryReplSet and I've set the storageEngine to 'wiredTiger'.
I'm also connecting to the db before each suite, I'm clearing the entire db before each test and closing the connection after each suite. This works fine.
I add my 2nd test, basically identical to the 1st one, it fails and says the db.watch was not called. I see that in between those tests the db connection was closed and reopend (added console.logs to track).
I set .only on the 2nd test - it passes as expected.
I have 5 watchers for 5 collections and I wrote the tests for each of the 5. Any single one of them I run alone (using .only) - it passes as expected. But as soon as I add any other 2nd one - the 1st one that runs passes and the 2nd one fails and says .watch was not called. And this happens no matter which 2 tests I pick to execute together.
I am loosing my mind trying to figure out why the test would pass alone but fail if another watch test ran before it? 😞
I have a RxJS Subject wrapper around the db.watch call which I did not reset on disconnect... so in between tests it looses the connection and thus cannot watch anymore.
Versions
package: mongo-memory-server
What is your question?
I am watching several collections.
I added my 1st watcher test and it works fine. Does exactly what is expected.
I'm using
MongoMemoryReplSet
and I've set thestorageEngine
to'wiredTiger'
.I'm also connecting to the db before each suite, I'm clearing the entire db before each test and closing the connection after each suite. This works fine.
I add my 2nd test, basically identical to the 1st one, it fails and says the
db.watch
was not called. I see that in between those tests the db connection was closed and reopend (added console.logs to track).I set
.only
on the 2nd test - it passes as expected.I have 5 watchers for 5 collections and I wrote the tests for each of the 5. Any single one of them I run alone (using
.only
) - it passes as expected. But as soon as I add any other 2nd one - the 1st one that runs passes and the 2nd one fails and says .watch was not called. And this happens no matter which 2 tests I pick to execute together.I am loosing my mind trying to figure out why the test would pass alone but fail if another watch test ran before it? 😞