Replies: 1 comment 5 replies
-
It looks fine to me, just some notes:
Just so you are aware, this only sets the port for the first instance. (each entry in the
MongoDB recommends to run uneven number of replsets, so i would suggest to either go with 3 or 5. Also know that more severs on a single machine might slow it down due to synchronization and likely working on the same data storage medium.
It would work, but might be unreliable, i would recommend just setting the
With just the given examples, it should likely not overload, but this might depend on the work you actually do in the tests themself (read / write).
|
Beta Was this translation helpful? Give feedback.
-
I have setup this structure:
jest.config.js
jest.setup.js
jest.teardown.js
An example test file:
db.ts
Does this follow best practices on how to structure tests with MongoDB in-memory?
I basically setup
MONGOD
injest.setup.js
, then in each one of the test files I connect to the instance (with a different database name), then after each test file I clear & close DB.I have many test files (more than 100) and I sometimes see timeouts when I connect to my DB (when
mongoose.connect
runs) so I was wondering whether with my current structure I might be overloading my memory server.FYI I use
--maxWorkers=4
when running tests.Beta Was this translation helpful? Give feedback.
All reactions