You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I am working on a project where I needed use a Replica Set because of MongoDb Transactions, and up to yesterday I did not need transactions on the project I am working on, but started getting errors on jest tests.
All previous unit and integration tests were passing successfully, but after implementing a transaction in a TransactionManager interface and test it, it starts breaking other tests even tho they are not related with the transactions, but with MongoDb instance.
On previous tests that required all that jest mongo connection template to test, it was working fine:
But then, after implementing one transaction, it all tests only works if I start cleaning the collection used (by any test) on afterEach method, and instantiating the collection on beforeAll method, like the following:
This transaction is only used in one use case not related to all other tests on the project, but it seems that this is breaking something on MongoDbMemoryServer which is instantiated, but by changing to clean every collection used in a test AFTER each test then all tests works magically.
The text was updated successfully, but these errors were encountered:
So I am working on a project where I needed use a Replica Set because of MongoDb Transactions, and up to yesterday I did not need transactions on the project I am working on, but started getting errors on jest tests.
All previous unit and integration tests were passing successfully, but after implementing a transaction in a TransactionManager interface and test it, it starts breaking other tests even tho they are not related with the transactions, but with MongoDb instance.
On previous tests that required all that jest mongo connection template to test, it was working fine:
Here is the error:
But then, after implementing one transaction, it all tests only works if I start cleaning the collection used (by any test) on afterEach method, and instantiating the collection on beforeAll method, like the following:
Here is the TransactionManager interface implemented:
NOTE
This transaction is only used in one use case not related to all other tests on the project, but it seems that this is breaking something on MongoDbMemoryServer which is instantiated, but by changing to clean every collection used in a test AFTER each test then all tests works magically.The text was updated successfully, but these errors were encountered: