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
feat: rewrite Logging via debug package under DEBUG=MongoMS:* key (#270)
* Add Dev-dependency "@types/debug"
* Change Typescript lib from "es2017" to "esnext"
* Added some Logging to "MongoBinaryDownloadUrl"
Transformed logging to use "debug"
"resolve-config" now gets loaded in index as an side-effect (load MONGOMS_DEBUG)
Added "Enable Debug Mode" section to README
Reorganized the README's documented options
* Remove "console.warn" check, because it dosnt run when debug is enabled
// or it should be stopped automatically when you exit from script
215
167
```
216
168
217
-
### Available options for Replica Set
169
+
### Available options for MongoMemoryReplSet
218
170
219
171
All options are optional.
220
172
221
173
```js
222
174
constreplSet=newMongoMemoryReplSet({
223
175
autoStart, // same as for MongoMemoryServer
224
176
binary: binaryOpts, // same as for MongoMemoryServer
225
-
debug, // same as for MongoMemoryServer
226
177
instanceOpts: [
227
178
{
228
179
args, // any additional instance specific args
@@ -255,6 +206,50 @@ const replSet = new MongoMemoryReplSet({
255
206
});
256
207
```
257
208
209
+
### Options which can be set via ENVIRONMENT variables
210
+
211
+
```sh
212
+
MONGOMS_DOWNLOAD_DIR=/path/to/mongodb/binaries
213
+
MONGOMS_PLATFORM=linux
214
+
MONGOMS_ARCH=x64
215
+
MONGOMS_VERSION=3
216
+
MONGOMS_DEBUG=1 # also available case-insensitive values: "on" "yes" "true"
217
+
MONGOMS_DOWNLOAD_MIRROR=host # your mirror host to download the mongodb binary
218
+
MONGOMS_DOWNLOAD_URL=url # full URL to download the mongodb binary
219
+
MONGOMS_DISABLE_POSTINSTALL=1 # if you want to skip download binaries on `npm i` command
220
+
MONGOMS_SYSTEM_BINARY=/usr/local/bin/mongod # if you want to use an existing binary already on your system.
221
+
MONGOMS_MD5_CHECK=1 # if you want to make MD5 check of downloaded binary.
222
+
# Passed constructor parameter `binary.checkMD5` has higher priority.
223
+
224
+
# GetOS specific ones (for linux only)
225
+
MONGOMS_USE_LINUX_LSB_RELEASE # Only try "lsb_release -a"
226
+
MONGOMS_USE_LINUX_OS_RELEASE # Only try to read "/etc/os-release"
227
+
MONGOMS_USE_LINUX_ANYFILE_RELEASE # Only try to read the first file found "/etc/*-release"
228
+
```
229
+
230
+
### Options which can be set via package.json's `config` section
231
+
232
+
You can also use package.json's `config` section to configure installation process.
233
+
Environment variables have higher priority than contents of package.json.
234
+
235
+
```json
236
+
{
237
+
"config": {
238
+
"mongodbMemoryServer": {
239
+
"downloadDir": "/path/to/mongodb/binaries",
240
+
"platform": "linux",
241
+
"arch": "x64",
242
+
"version": "3",
243
+
"debug": "1",
244
+
"downloadMirror": "url",
245
+
"disablePostinstall": "1",
246
+
"systemBinary": "/usr/local/bin/mongod",
247
+
"md5Check": "1"
248
+
}
249
+
}
250
+
}
251
+
```
252
+
258
253
### Simple test with MongoClient
259
254
260
255
Take a look at this [test file](https://github.com/nodkz/mongodb-memory-server/blob/master/packages/mongodb-memory-server-core/src/__tests__/singleDB-test.ts).
@@ -468,6 +463,26 @@ There isn't currently an official MongoDB release for alpine linux. This means t
468
463
built in and then set the MONGOMS_SYSTEM_BINARY variable to point at that binary. This should allow you to use
469
464
mongodb-memory-server on any system on which you can install mongod.
470
465
466
+
### Enable Debug Mode
467
+
468
+
The Debug mode can be enabled with an Environment-Variable or in the package.json "config" section:
469
+
470
+
```sh
471
+
MONGOMS_DEBUG=1 # also available case-insensitive values: "on" "yes" "true"
472
+
```
473
+
474
+
or
475
+
476
+
```json
477
+
{
478
+
"config": {
479
+
"mongodbMemoryServer": {
480
+
"debug": "1", // also available case-insensitive values: "on" "yes" "true"
481
+
}
482
+
}
483
+
}
484
+
```
485
+
471
486
## Travis
472
487
473
488
**It is very important** to limit spawned number of Jest workers for avoiding race condition. Cause Jest spawn huge amount of workers for every node environment on same machine. [More details](https://github.com/facebook/jest/issues/3765)
0 commit comments