Comments (12)
In some cases, mongod binary may download about 1 minute the first time.
Most developers don't know how to increase timeouts in test runners. And by default after 5 seconds tests halts.
So for making testing without additional configuration, I decide to download latest version on postinstall script. It allows starting testing with zero configuration.
from mongodb-memory-server.
@nodkz Just found this : https://www.npmjs.com/package/find-cache-dir (it's even more popular than
https://www.npmjs.com/package/pkg-conf)
Wouldn't it be even simpler to just use this instead of %HOME/.mongodb-binaries
as the default ? Is would solve the problem of polluting the HOME
folder and wouldn't require any config !
What do you think ?
from mongodb-memory-server.
@guillaumervls You should use the environnement variable MONGOMS_DOWNLOAD_DIR that specify a path where to download the mongodb binaries instead of the downloadDir option, because it will be used in the postinstall script as well :)
from mongodb-memory-server.
Yes I saw that, I find it weird that I'd have to add env vars to opt-out of this. It breaks the simple git clone
+ npm install
... Switching this behavior from opt-out (MONGOMS_DISABLE_POSTINSTALL=1
) to opt-in (with something like MONGOMS_ENABLE_POSTINSTALL=1
) wouldn't be breaking anything (download of binaries has to be done at some time anyway), and wouldn't pollute home dir by default.
from mongodb-memory-server.
Disabling downloading via MONGOMS_DISABLE_POSTINSTALL
env variable is less evil.
from mongodb-memory-server.
Ok then isn't there a more appropriate place to download them (more local to the project) ?
from mongodb-memory-server.
Or read a setting from package.json
? Setting an environment variable puts this responsibility on the users of the package using this lib, forcing them to use MONGOMS_DISABLE_POSTINSTALL=1 npm install
. With a setting in package.json
they could just npm install
.
from mongodb-memory-server.
Sounds sweet if we can provide some vars via package.json or even .dot file.
Any proposal how it can be implemented? Need to use expierence from jest, babel, ts or any other implementation.
I feel your tension and dissapoinment about current ways of configuration. no one has raised this problem yet and you are the first! So let's solve this problem.
from mongodb-memory-server.
Cool ! From what I've seen popular modules like Husky, Babel, and Jest, use a package.json
key matching their npm
name (babel
, husky
, jest
). Only ESLint uses eslintConfig
. In our case it could be mongodb-memory-server
.
IMHO, special config files like .babelrc
should be used if they were so many config options that it could bloat package.json
. It may not be necessary for the 7 options available here (the 7 MONGOMS_XXX
env vars).
To implement this, I suggest the use of https://www.npmjs.com/package/pkg-conf which seems quite popular, and does exactly what we want.
from mongodb-memory-server.
@guillaumervls if you have free time you may implement this feature with mongodb-memory-server
key in package.json.
My current bandwidth till the end of year does not allow to do it myself 😞
And I will be very glad if somebody takes care about this feature. 🙏
Thanks.
from mongodb-memory-server.
Implemented in https://github.com/nodkz/mongodb-memory-server/releases/tag/v2.7.0
from mongodb-memory-server.
🎉 This issue has been resolved in version 2.7.0 🎉
The release is available on:
Your semantic-release bot 📦🚀
from mongodb-memory-server.
Related Issues (20)
- oplogSize for replSet should be removed in README HOT 2
- Use RHEL 9 binaries HOT 2
- Add Support for "Rocky Linux 9" HOT 4
- [SOLUTION] Jest and Fake Timers HOT 1
- Amazon EC2 instance download failed, combination does not exist (403) HOT 4
- "getport" sometimes throwing an error HOT 43
- DownloadError: Download failed for url "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-5.0.19.tgz" HOT 10
- Weird "db.watch" issue HOT 1
- postinstallHelper always installs to $HOME/.cache instead of node_modules/.cache HOT 6
- Enabling debug mode through package.json does not work HOT 3
- Randomizing db names for each test
- GridFS streams not working correctly HOT 4
- Jest + mongodb-memory-server + mongoose - Calling 'find' hangs indefinitely HOT 2
- Invalid version reported for version strings ending in -latest HOT 2
- Ubuntu >= 22.04 is unsupported when using MongoDB >= 6.0.4 HOT 7
- _startUpInstance threw a Error: TypeError: (intermediate value).finally is not a function HOT 3
- Mongod instance closed with code "127" HOT 7
- Case: InMemory DB refuses to update after Making changes to model HOT 7
- Library is missing or cannot be opened: "libcrypto.so.1.1" HOT 2
- 9.1.8 not working out of the box for node:20 docker (LTS images) HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mongodb-memory-server.