
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@lyvly/mock-mongo
Advanced tools
Mocks a Mongo Replica Set, using mongodb-memory-server
.
There are many motivations in life for building packages, this one was simple. We use the mock DB everywhere, and we needed to prove that we could publish libraries in a nice simple concise manner. So here we are.
In your test file, import MockMongo
:
import { MockMongo } from '@lyvly/mock-mongo
To start the db:
await MockMongo.start([options])
By default, we use the following mongodb-memory-server
options:
debug: false,
replSet: {
storageEngine: 'wiredTiger',
},
You can override this by passing your own options to start
.
start
returns the mongo memory server instance.
To get the connection uri:
await MockMongo.getUri()
To stop the DB:
await MockMongo.stop()
To get a native mongo collection to test against:
await MockMongo.getCollection(databaseName, collectionName)
To get the mongo memory server instance
MockMongo.get()
To set a new mongo memory server instance
MockMongo.set(mongoInstance)
FAQs
Mocks a Mongo Replica Set
We found that @lyvly/mock-mongo demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.