package: mongo-memory-server
_MMS = mongodb-memory-server_
I use MMS in a package of workspace and after installing dependencies and running a test script in the package, MMS tries to download the binary file. But if I run the test command from the root folder of the workspace, MMS can find the binary file from node_modules/.cache folder.
What I mean by root directory is: C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x
And what I meant by package directory is: C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\packages\my-app
Here is the folder structure:

Here is the minimal repo https://github.com/seahindeniz/mongodb-memory-server-issue-489
I'm not sure why, but I guess postinstall script installs the binary file to the upper node_modules folder rather than installing to the closest node_modules folder and using it from the closest node_modules. I guess it should work respectfully
I'm not sure why, but I guess postinstall script installs the binary file to the upper node_modules folder rather than installing to the closest node_modules folder and using it from the closest node_modules. I guess it should work respectfully
(the following is for the 7.0.0 beta)
the binary gets installed relative to INIT_CWD/../..(basically) (npm and yarn environment variable) and from that point uses the package find-cache-dir to find the nearest(upwards) package.json and from there relative to the package.json found node_modules/.cache
could you provide the following:
node_modules or the lower package node_modules)projectroot/node_modules/.cache/mongodb-memory-server)MONGOMS_DEBUG=1)PS: if you use npm 7.0.0, you will need to run the install for postinstall with --foreground-scripts and please run the install with an clean node_modules/.cache directory
in which path is the package actually installed to? (the workspace node_modules or the lower package node_modules)
Well, from what I can tell, the package is installed to <projectRoot>\node_modules\.pnpm\[email protected]\node_modules\mongodb-memory-server and it's hard linked (symlink) to <projectRoot>\packages\my-app\node_modules\mongodb-memory-server directory.
to clarify, in which what is the binary currently installed to? (probably projectroot/node_modules/.cache/mongodb-memory-server)
That's correct.
could you provide the debug log for the postinstall and the actual running? (MONGOMS_DEBUG=1)
Sure
MONGOMS_DEBUG=1 pnpm i
Sahin@Sahin-NB MINGW64 ~/projects/temp/mongodb-memory-server-issue-x (with-pnpm)
$ MONGOMS_DEBUG=1 pnpm i
Scope: all 2 workspace projects
Lockfile is up-to-date, resolution step is skipped
Packages: +400
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Packages are hard linked from the content-addressable store to the virtual store.
Content-addressable store is at: C:\Users\Sahin\.pnpm-store\v3
Virtual store is at: node_modules/.pnpm
Progress: resolved 400, reused 400, downloaded 0, added 400, done
node_modules/.pnpm/[email protected]/node_modules/mongodb-memory-server: Running postinstall script, done in 8m 55.7s
MONGOMS_DEBUG=1 pnpm test
Sahin@Sahin-NB MINGW64 ~/projects/temp/mongodb-memory-server-issue-x/packages/my-app (with-pnpm)
$ MONGOMS_DEBUG=1 pnpm test
> @mongodb-memory-server-issue-489/[email protected] test C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\packages\my-app
> jest --detectOpenHandles --forceExit
MongoMS:MongoMemoryServer create: Called .create() method +0ms
MongoMS:MongoMemoryServer start: Called .start() method +3ms
MongoMS:MongoMemoryServer _startUpInstance: Called MongoMemoryServer._startUpInstance() method +1ms
MongoMS:MongoMemoryServer getStartOptions +2ms
MongoMS:MongoMemoryServer _startUpInstance: Creating new MongoDB instance with options: {"instance":{"port":61375,"dbName":"","ip":"127.0.0.1","storageEngine":"ephemeralForTest","dbPath":"C:\\Users\\Sahin\\AppData\\Local\\Temp\\mongo-mem--13508-9K5bP3GbRFuB","tmpDir":{"name":"C:\\Users\\Sahin\\AppData\\Local\\Temp\\mongo-mem--13508-9K5bP3GbRFuB"}}} +39ms
MongoMS:MongoInstance create: Called .create() method +0ms
MongoMS:MongoInstance Mongo[61375]: start +2ms
MongoMS:MongoBinary getPath +0ms
MongoMS:DryMongoBinary generateDownloadPath: Generating Download Path, preferGlobal: "true" +0ms
MongoMS:DryMongoBinary generateDownloadPath: Paths: {
legacyHomeCache: '',
modulesCache: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\node_modules\\.cache\\mongodb-memory-server\\mongod-x64-win32-4.0.25.exe',
relative: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\mongodb-binaries\\mongod-x64-win32-4.0.25.exe',
resolveConfig: ''
} +28ms
MongoMS:DryMongoBinary generateDownloadPath: no existing binary for version "4.0.25" was found +14ms
MongoMS:DryMongoBinary generateDownloadPath: using modulesCache "C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\packages\my-app\node_modules\.cache\mongodb-memory-server\mongod-x64-win32-4.0.25.exe" +3ms
MongoMS:MongoBinary getPath: MongoBinary options: {
"version": "4.0.25",
"downloadDir": "C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\node_modules\\.cache\\mongodb-memory-server",
"os": {
"os": "win32"
},
"arch": "x64",
"systemBinary": "",
"platform": "win32",
"checkMD5": false
} +51ms
MongoMS:DryMongoBinary locateBinary: Trying to locate Binary for version "4.0.25" +5ms
MongoMS:DryMongoBinary generateDownloadPath: Generating Download Path, preferGlobal: "true" +2ms
MongoMS:DryMongoBinary generatePaths: resolveConfigValue is not empty +8ms
MongoMS:DryMongoBinary generateDownloadPath: Paths: {
legacyHomeCache: '',
modulesCache: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\node_modules\\.cache\\mongodb-memory-server\\mongod-x64-win32-4.0.25.exe',
relative: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\mongodb-binaries\\mongod-x64-win32-4.0.25.exe',
resolveConfig: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\node_modules\\.cache\\mongodb-memory-server\\mongod-x64-win32-4.0.25.exe'
} +2ms
MongoMS:DryMongoBinary generateDownloadPath: no existing binary for version "4.0.25" was found +7ms
MongoMS:DryMongoBinary generateDownloadPath: using resolveConfig (DOWNLOAD_DIR) "C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\packages\my-app\node_modules\.cache\mongodb-memory-server\mongod-x64-win32-4.0.25.exe" +4ms
MongoMS:DryMongoBinary locateBinary: running generateDownloadPath +1ms
MongoMS:DryMongoBinary generateDownloadPath: Generating Download Path, preferGlobal: "true" +2ms
MongoMS:DryMongoBinary generatePaths: resolveConfigValue is not empty +2ms
MongoMS:DryMongoBinary generateDownloadPath: Paths: {
legacyHomeCache: '',
modulesCache: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\node_modules\\.cache\\mongodb-memory-server\\mongod-x64-win32-4.0.25.exe',
relative: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\mongodb-binaries\\mongod-x64-win32-4.0.25.exe',
resolveConfig: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\node_modules\\.cache\\mongodb-memory-server\\mongod-x64-win32-4.0.25.exe'
} +2ms
MongoMS:DryMongoBinary generateDownloadPath: no existing binary for version "4.0.25" was found +12ms
MongoMS:DryMongoBinary generateDownloadPath: using resolveConfig (DOWNLOAD_DIR) "C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\packages\my-app\node_modules\.cache\mongodb-memory-server\mongod-x64-win32-4.0.25.exe" +1ms
MongoMS:DryMongoBinary locateBinary: could not find an existing binary +1ms
MongoMS:MongoBinary getPath: "RUNTIME_DOWNLOAD" is "true", trying to download +48ms
MongoMS:MongoBinary download +1ms
MongoMS:MongoBinary download: Waiting to acquire Download lock for file "C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\packages\my-app\node_modules\.cache\mongodb-memory-server\4.0.25.lock" +7ms
MongoMS:LockFile lock: Locking file "C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\packages\my-app\node_modules\.cache\mongodb-memory-server\4.0.25.lock" +0ms
MongoMS:LockFile checkLock: for file "C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\packages\my-app\node_modules\.cache\mongodb-memory-server\4.0.25.lock" with uuid: "undefined" +2ms
MongoMS:LockFile createLock: trying to create a lock file for "C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\packages\my-app\node_modules\.cache\mongodb-memory-server\4.0.25.lock" +2ms
MongoMS:LockFile createLock: Lock File Created for file "C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\packages\my-app\node_modules\.cache\mongodb-memory-server\4.0.25.lock" +12ms
MongoMS:MongoBinary download: Download lock acquired +25ms
MongoMS:MongoBinary download: Adding version 4.0.25 to cache +1ms
MongoMS:MongoBinaryDownload getMongodPath +0ms
MongoMS:DryMongoBinary generateDownloadPath: Generating Download Path, preferGlobal: "true" +37ms
MongoMS:DryMongoBinary generatePaths: resolveConfigValue is not empty +9ms
MongoMS:DryMongoBinary generateDownloadPath: Paths: {
legacyHomeCache: '',
modulesCache: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\node_modules\\.cache\\mongodb-memory-server\\mongod-x64-win32-4.0.25.exe',
relative: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\mongodb-binaries\\mongod-x64-win32-4.0.25.exe',
resolveConfig: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\node_modules\\.cache\\mongodb-memory-server\\mongod-x64-win32-4.0.25.exe'
} +2ms
MongoMS:DryMongoBinary generateDownloadPath: no existing binary for version "4.0.25" was found +4ms
MongoMS:DryMongoBinary generateDownloadPath: using resolveConfig (DOWNLOAD_DIR) "C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\packages\my-app\node_modules\.cache\mongodb-memory-server\mongod-x64-win32-4.0.25.exe" +2ms
MongoMS:MongoBinaryDownload startDownload +20ms
MongoMS:MongoBinaryDownloadUrl Using "mongodb-win32-x86_64-2008plus-ssl-4.0.25.zip" as the Archive String +0ms
MongoMS:MongoBinaryDownloadUrl Using "https://fastdl.mongodb.org" as the mirror +4ms
MongoMS:MongoBinaryDownload download +16ms
MongoMS:MongoBinaryDownload download: Downloading: "https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-4.0.25.zip" +1ms
MongoMS:MongoBinaryDownload httpDownload +3ms
MongoMS:MongoBinaryDownload httpDownload: trying to download "https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-4.0.25.zip" +3ms
FAIL test/dbConnection.spec.ts (7.73 s)b / 249.8mb)
● Test DB connection › should connect database successfully
thrown: "Exceeded timeout of 5000 ms for a test.
Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."
8 | });
9 |
> 10 | it('should connect database successfully', async () => {
| ^
11 | await expect(connectDB()).resolves.toBeUndefined();
12 | });
13 | });
at test/dbConnection.spec.ts:10:3
at Object.<anonymous> (test/dbConnection.spec.ts:3:1)
at TestScheduler.scheduleTests (../../node_modules/.pnpm/@[email protected][email protected]/node_modules/@jest/core/build/TestScheduler.js:333:13)
at runJest (../../node_modules/.pnpm/@[email protected][email protected]/node_modules/@jest/core/build/runJest.js:387:19)
at _run10000 (../../node_modules/.pnpm/@[email protected][email protected]/node_modules/@jest/core/build/cli/index.js:408:7)
at runCLI (../../node_modules/.pnpm/@[email protected][email protected]/node_modules/@jest/core/build/cli/index.js:261:3)
● Test suite failed to run
MongooseError: Connection 0 was disconnected when calling `dropDatabase`
19 |
20 | export const closeDB = async (): Promise<void> => {
> 21 | await mongoose.connection.dropDatabase();
| ^
22 | await mongoose.connection.close();
23 | await mongoServer.stop();
24 | };
at NativeConnection.dropDatabase (../../node_modules/.pnpm/[email protected]/node_modules/mongoose/lib/connection.js:565:31)
at closeDB (test/dbHandler.ts:21:29)
at TestScheduler.scheduleTests (../../node_modules/.pnpm/@[email protected][email protected]/node_modules/@jest/core/build/TestScheduler.js:333:13)
at runJest (../../node_modules/.pnpm/@[email protected][email protected]/node_modules/@jest/core/build/runJest.js:387:19)
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 passed, 2 total
Snapshots: 0 total
Time: 8.086 s
Ran all test suites.
ERROR Test failed. See above for more details.
I'm actually using pnpm and I'm not sure if --foreground-scripts even works for pnpm or it has a similar command
for pnpm i command, did you clear the .cache folder first?
and it seems like pnpm does not require foreground-scripts, but also seems to not pass the environment variable to the script (or at lest does not print more than the first line)
as for the second log, it is as much as i expected, but would require the debug log from the postinstall to match against
and because you use pnpm, where is the cache folder:
projectroot/node_moduels/.cache (probably here) orprojectroot/node_modules/.pnpm/.cacheas for workarounds:
DOWNLOAD_DIRPREFER_GLOBAL_PATH to force the download into an home directory (recommended)(but for both to take effect, you either need to re-run the postinstall script, or need to runtime download for once)
PS: does your package.json inside packages contain the property config.mongodbMemoryServer or does the workspace package.json contain it?
for pnpm i command, did you clear the .cache folder first?
Yes. I even remove all node_modules too.
as for the second log, it is as much as i expected, but would require the debug log from the postinstall to match against
I'm not sure if it's even possible
and because you use pnpm, where is the cache folder:
It's located in the projectroot/node_moduels/.cache folder
you could set an custom download directory, with DOWNLOAD_DIR
I actually tried that as well. But it still downloads in the root node_modules folder. Here is the config:
projectRoot/packages/my-app/package.json
{
"config": {
"mongodbMemoryServer": {
"downloadDir": "./node_modules/.cache/mongodb-memory-server"
}
}
}
````
> you could enable PREFER_GLOBAL_PATH to force the download into an home directory (recommended)
I'm not exactly sure how should I set this option but I tried to set it didn't work either.
`projectRoot/packages/my-app/package.json`
```json
{
"config": {
"mongodbMemoryServer": {
"PREFER_GLOBAL_PATH": true
}
}
}
(but for both to take effect, you either need to re-run the postinstall script, or need to runtime download for once)
I delete all node_modules just to make sure that I'm performing fresh install
PS: does your package.json inside packages contain the property config.mongodbMemoryServer or does the workspace package.json contain it?
I put config in package.json that is inside the packages directory
Umm, you can also check test this on your side as well. I have created a minimal repo, and I'm also running tests on it as well
I just downgrade the MongoMS from "7.0.0-beta.49" to "7.0.0-beta.42" and following config worked:
{
"config": {
"mongodbMemoryServer": {
"downloadDir": "./node_modules/mongodb-memory-server"
}
}
}
Postinstall script have downloaded the binary file to that folder.
I guess, postinstall script in the version 7.0.0-beta.49 doesn't respect the config field in projectRoot/packages/my-app/package.json file
I just downgrade the MongoMS from "7.0.0-beta.49" to "7.0.0-beta.42" and following config worked:
this is weird, because between 42 and 49 (of 7.0.0-beta.x), not really much changed in this regard
I'm not exactly sure how should I set this option but I tried to set it didn't work either.
sorry if this was not clear in the documentation, you have to convert all config options to camelCase for the package.json values, as seen here
I put config in package.json that is inside the packages directory
maybe try to set them inside the workspace package.json
Umm, you can also check test this on your side as well. I have created a minimal repo, and I'm also running tests on it as well
could you maybe provide it? because your provided https://github.com/seahindeniz/mongodb-memory-server-issue-489 is a 404 for me
I'm terribly sorry for sharing a private repo, I forgot to change its visibility setting 😓 It is now public.
I have run test command with debug variable while the preferGlobalPath config is set to true:
MONGOMS_DEBUG=1 pnpm test
> @mongodb-memory-server-issue-489/[email protected] test C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\packages\my-app
> jest --detectOpenHandles --forceExit
MongoMS:MongoMemoryServer create: Called .create() method +0ms
MongoMS:MongoMemoryServer start: Called .start() method +2ms
MongoMS:MongoMemoryServer _startUpInstance: Called MongoMemoryServer._startUpInstance() method +2ms
MongoMS:MongoMemoryServer getStartOptions +2ms
MongoMS:MongoMemoryServer _startUpInstance: Creating new MongoDB instance with options: {"instance":{"port":64055,"dbName":"","ip":"127.0.0.1","storageEngine":"ephemeralForTest","dbPath":"C:\\Users\\Sahin\\AppData\\Local\\Temp\\mongo-mem--10228-jJ4zUSRpQ5Jn","tmpDir":{"name":"C:\\Users\\Sahin\\AppData\\Local\\Temp\\mongo-mem--10228-jJ4zUSRpQ5Jn"}}} +34ms
MongoMS:MongoInstance create: Called .create() method +0ms
MongoMS:MongoInstance Mongo[64055]: start +1ms
MongoMS:MongoBinary getPath +0ms
FAIL test/dbConnection.spec.ts
● Test DB connection › should connect database successfully
expect(received).resolves.toBeUndefined()
Received promise rejected instead of resolved
Rejected to value: [TypeError: env.toLowerCase is not a function]
9 |
10 | it('should connect database successfully', async () => {
> 11 | await expect(connectDB()).resolves.toBeUndefined();
| ^
12 | });
13 | });
14 |
at expect (../../node_modules/.pnpm/[email protected]/node_modules/expect/build/index.js:135:15)
at Object.<anonymous> (test/dbConnection.spec.ts:11:11)
at TestScheduler.scheduleTests (../../node_modules/.pnpm/@[email protected][email protected]/node_modules/@jest/core/build/TestScheduler.js:333:13)
● Test suite failed to run
MongooseError: Connection 0 was disconnected when calling `dropDatabase`
19 |
20 | export const closeDB = async (): Promise<void> => {
> 21 | await mongoose.connection.dropDatabase();
| ^
22 | await mongoose.connection.close();
23 | await mongoServer.stop();
24 | };
at NativeConnection.dropDatabase (../../node_modules/.pnpm/[email protected]/node_modules/mongoose/lib/connection.js:565:31)
at closeDB (test/dbHandler.ts:21:29)
at TestScheduler.scheduleTests (../../node_modules/.pnpm/@[email protected][email protected]/node_modules/@jest/core/build/TestScheduler.js:333:13)
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 passed, 2 total
Snapshots: 0 total
Time: 3.074 s
Ran all test suites.
ERROR Test failed. See above for more details.
Even with preferGlobalPath: true, the binary file is downloaded to projectRoot/node_modules/.cache/mongodb-memory-server and apparently it tries to find it in a temp folder, not sure why.
maybe try to set them inside the workspace package.json
I tried setting the downloadDir config in the projectRoot/package.json:
{
"config": {
"mongodbMemoryServer": {
"downloadDir": "./node_modules/mongodb-memory-server"
}
}
}
postinstall has recognized the downloadDir config, and it has downloaded the binary file to the projectRoot/node_modules/mongodb-memory-server that shouldn't be created in the first place. Because it's the root node_modules folder that is not the scope of root because package.json in the root folder, has its own dependency scope when you work with pnpm.
Here is the output
$ MONGOMS_DEBUG=1 pnpm test
> @mongodb-memory-server-issue-489/[email protected] test C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\packages\my-app
> jest --detectOpenHandles --forceExit
MongoMS:MongoMemoryServer create: Called .create() method +0ms
MongoMS:MongoMemoryServer start: Called .start() method +2ms
MongoMS:MongoMemoryServer _startUpInstance: Called MongoMemoryServer._startUpInstance() method +2ms
MongoMS:MongoMemoryServer getStartOptions +1ms
MongoMS:MongoMemoryServer _startUpInstance: Creating new MongoDB instance with options: {"instance":{"port":50287,"dbName":"","ip":"127.0.0.1","storageEngine":"ephemeralForTest","dbPath":"C:\\Users\\Sahin\\AppData\\Local\\Temp\\mongo-mem--24640-HRWzF1MnSECx","tmpDir":{"name":"C:\\Users\\Sahin\\AppData\\Local\\Temp\\mongo-mem--24640-HRWzF1MnSECx"}}} +32ms
MongoMS:MongoInstance create: Called .create() method +0ms
MongoMS:MongoInstance Mongo[50287]: start +1ms
MongoMS:MongoBinary getPath +0ms
MongoMS:DryMongoBinary generateDownloadPath: Generating Download Path, preferGlobal: "true" +0ms
MongoMS:DryMongoBinary generatePaths: resolveConfigValue is not empty +22ms
MongoMS:DryMongoBinary generateDownloadPath: Paths: {
legacyHomeCache: '',
modulesCache: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\node_modules\\.cache\\mongodb-memory-server\\mongod-x64-win32-4.0.25.exe',
relative: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\mongodb-binaries\\mongod-x64-win32-4.0.25.exe',
resolveConfig: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\node_modules\\mongodb-memory-server\\mongod-x64-win32-4.0.25.exe'
} +2ms
MongoMS:DryMongoBinary generateDownloadPath: no existing binary for version "4.0.25" was found +10ms
MongoMS:DryMongoBinary generateDownloadPath: using resolveConfig (DOWNLOAD_DIR) "C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\packages\my-app\node_modules\mongodb-memory-server\mongod-x64-win32-4.0.25.exe" +3ms
MongoMS:MongoBinary getPath: MongoBinary options: {
"version": "4.0.25",
"downloadDir": "C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\node_modules\\mongodb-memory-server",
"os": {
"os": "win32"
},
"arch": "x64",
"systemBinary": "",
"platform": "win32",
"checkMD5": false
} +42ms
MongoMS:DryMongoBinary locateBinary: Trying to locate Binary for version "4.0.25" +6ms
MongoMS:DryMongoBinary generateDownloadPath: Generating Download Path, preferGlobal: "true" +1ms
MongoMS:DryMongoBinary generatePaths: resolveConfigValue is not empty +5ms
MongoMS:DryMongoBinary generateDownloadPath: Paths: {
legacyHomeCache: '',
modulesCache: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\node_modules\\.cache\\mongodb-memory-server\\mongod-x64-win32-4.0.25.exe',
relative: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\mongodb-binaries\\mongod-x64-win32-4.0.25.exe',
resolveConfig: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\node_modules\\mongodb-memory-server\\mongod-x64-win32-4.0.25.exe'
} +3ms
MongoMS:DryMongoBinary generateDownloadPath: no existing binary for version "4.0.25" was found +10ms
MongoMS:DryMongoBinary generateDownloadPath: using resolveConfig (DOWNLOAD_DIR) "C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\packages\my-app\node_modules\mongodb-memory-server\mongod-x64-win32-4.0.25.exe" +3ms
MongoMS:DryMongoBinary locateBinary: running generateDownloadPath +1ms
MongoMS:DryMongoBinary generateDownloadPath: Generating Download Path, preferGlobal: "true" +1ms
MongoMS:DryMongoBinary generatePaths: resolveConfigValue is not empty +4ms
MongoMS:DryMongoBinary generateDownloadPath: Paths: {
legacyHomeCache: '',
modulesCache: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\node_modules\\.cache\\mongodb-memory-server\\mongod-x64-win32-4.0.25.exe',
relative: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\mongodb-binaries\\mongod-x64-win32-4.0.25.exe',
resolveConfig: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\node_modules\\mongodb-memory-server\\mongod-x64-win32-4.0.25.exe'
} +2ms
MongoMS:DryMongoBinary generateDownloadPath: no existing binary for version "4.0.25" was found +5ms
MongoMS:DryMongoBinary generateDownloadPath: using resolveConfig (DOWNLOAD_DIR) "C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\packages\my-app\node_modules\mongodb-memory-server\mongod-x64-win32-4.0.25.exe" +4ms
MongoMS:DryMongoBinary locateBinary: could not find an existing binary +2ms
MongoMS:MongoBinary getPath: "RUNTIME_DOWNLOAD" is "true", trying to download +45ms
MongoMS:MongoBinary download +2ms
MongoMS:MongoBinary download: Waiting to acquire Download lock for file "C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\packages\my-app\node_modules\mongodb-memory-server\4.0.25.lock" +5ms
MongoMS:LockFile lock: Locking file "C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\packages\my-app\node_modules\mongodb-memory-server\4.0.25.lock" +0ms
MongoMS:LockFile checkLock: for file "C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\packages\my-app\node_modules\mongodb-memory-server\4.0.25.lock" with uuid: "undefined" +3ms
MongoMS:LockFile createLock: trying to create a lock file for "C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\packages\my-app\node_modules\mongodb-memory-server\4.0.25.lock" +4ms
MongoMS:LockFile createLock: Lock File Created for file "C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\packages\my-app\node_modules\mongodb-memory-server\4.0.25.lock" +10ms
MongoMS:MongoBinary download: Download lock acquired +26ms
MongoMS:MongoBinary download: Adding version 4.0.25 to cache +1ms
MongoMS:MongoBinaryDownload getMongodPath +0ms
MongoMS:DryMongoBinary generateDownloadPath: Generating Download Path, preferGlobal: "true" +38ms
MongoMS:DryMongoBinary generatePaths: resolveConfigValue is not empty +8ms
MongoMS:DryMongoBinary generateDownloadPath: Paths: {
legacyHomeCache: '',
modulesCache: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\node_modules\\.cache\\mongodb-memory-server\\mongod-x64-win32-4.0.25.exe',
relative: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\mongodb-binaries\\mongod-x64-win32-4.0.25.exe',
resolveConfig: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\node_modules\\mongodb-memory-server\\mongod-x64-win32-4.0.25.exe'
} +3ms
MongoMS:DryMongoBinary generateDownloadPath: no existing binary for version "4.0.25" was found +6ms
MongoMS:DryMongoBinary generateDownloadPath: using resolveConfig (DOWNLOAD_DIR) "C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\packages\my-app\node_modules\mongodb-memory-server\mongod-x64-win32-4.0.25.exe" +2ms
MongoMS:MongoBinaryDownload startDownload +24ms
MongoMS:MongoBinaryDownloadUrl Using "mongodb-win32-x86_64-2008plus-ssl-4.0.25.zip" as the Archive String +0ms
MongoMS:MongoBinaryDownloadUrl Using "https://fastdl.mongodb.org" as the mirror +8ms
MongoMS:MongoBinaryDownload download +25ms
MongoMS:MongoBinaryDownload download: Downloading: "https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-4.0.25.zip" +1ms
MongoMS:MongoBinaryDownload httpDownload +3ms
MongoMS:MongoBinaryDownload httpDownload: trying to download "https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-4.0.25.zip" +3ms
Downloading MongoDB "4.0.25": 3.6% (9.1mb / 249.8mb)
RUNS test/dbConnection.spec.ts
I have terminated the test process, because no need to wait for it to be downloaded again since test process will timeout and fail.
I tried setting the downloadDir config in the projectRoot/package.json:
DOWNLOAD_DIR option is meant to be absolute, but if its not, then its implicitly resolved with process.cwd(), which can be very wrong in an install
apparently it tries to find it in a temp folder, not sure why.
if you mean the message from _startUpInstance: Creating new MongoDB instance with options:, then no, this package creates an temporary directory (in the system's temp folder) to the database to use (mongod --dbPath option)
I have run test command with debug variable while the preferGlobalPath config is set to true:
could you provide how you have set this? because it seems to have thrown an very weird error somehow (an value was not an string, where it should always have been an string, fixed with beta 50)
I have terminated the test process, because no need to wait for it to be downloaded again since test process will timeout and fail.
btw, if you want you can set RUNTIME_DOWNLOAD to false, and it will error out instead of trying to download on runtime
beta 50 should be released soon (~10min), which includes some fixes i noticed from the logs
PS: thanks to the reproduction repo, i will now try to use pnpm and the repo in an VM
an value was not an string, where it should always have been an string,
I couldn't find a value type on the documentation so I assumed it was accepting a boolean value.
could you provide how you have set this?
Here:
projectRoot/package.json
{
"config": {
"mongodbMemoryServer": {
"preferGlobalPath": true
}
}
}
it seems to have thrown an very weird error somehow
Yeah, I just checked and jest is also showing a weird error
$ MONGOMS_DEBUG=1 pnpm test
> @mongodb-memory-server-issue-489/[email protected] test C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\packages\my-app
> jest --detectOpenHandles --forceExit
MongoMS:MongoMemoryServer create: Called .create() method +0ms
MongoMS:MongoMemoryServer start: Called .start() method +2ms
MongoMS:MongoMemoryServer _startUpInstance: Called MongoMemoryServer._startUpInstance() method +1ms
MongoMS:MongoMemoryServer getStartOptions +1ms
MongoMS:MongoMemoryServer _startUpInstance: Creating new MongoDB instance with options: {"instance":{"port":61527,"dbName":"","ip":"127.0.0.1","storageEngine":"ephemeralForTest","dbPath":"C:\\Users\\Sahin\\AppData\\Local\\Temp\\mongo-mem--18488-Gsxd30mTFzXZ","tmpDir":{"name":"C:\\Users\\Sahin\\AppData\\Local\\Temp\\mongo-mem--18488-Gsxd30mTFzXZ"}}} +32ms
MongoMS:MongoInstance create: Called .create() method +0ms
MongoMS:MongoInstance Mongo[61527]: start +1ms
MongoMS:MongoBinary getPath +0ms
FAIL test/dbConnection.spec.ts
● Test DB connection › should connect database successfully
expect(received).resolves.toBeUndefined()
Received promise rejected instead of resolved
Rejected to value: [TypeError: env.toLowerCase is not a function]
9 |
10 | it('should connect database successfully', async () => {
> 11 | await expect(connectDB()).resolves.toBeUndefined();
| ^
12 | });
13 | });
14 |
at expect (../../node_modules/.pnpm/[email protected]/node_modules/expect/build/index.js:135:15)
at Object.<anonymous> (test/dbConnection.spec.ts:11:11)
at TestScheduler.scheduleTests (../../node_modules/.pnpm/@[email protected][email protected]/node_modules/@jest/core/build/TestScheduler.js:333:13)
● Test suite failed to run
MongooseError: Connection 0 was disconnected when calling `dropDatabase`
19 |
20 | export const closeDB = async (): Promise<void> => {
> 21 | await mongoose.connection.dropDatabase();
| ^
22 | await mongoose.connection.close();
23 | await mongoServer.stop();
24 | };
at NativeConnection.dropDatabase (../../node_modules/.pnpm/[email protected]/node_modules/mongoose/lib/connection.js:565:31)
at closeDB (test/dbHandler.ts:21:29)
at TestScheduler.scheduleTests (../../node_modules/.pnpm/@[email protected][email protected]/node_modules/@jest/core/build/TestScheduler.js:333:13)
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 passed, 2 total
Snapshots: 0 total
Time: 3.816 s, estimated 4 s
Ran all test suites.
ERROR Test failed. See above for more details
i could get further, thanks to https://github.com/pnpm/pnpm/discussions/3568
for completion, here is my output
postinstall Output
Scope: all 2 workspace projects
Lockfile is up-to-date, resolution step is skipped
Progress: resolved 1, reused 0, downloaded 0, added 0
Packages: +400
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Packages are hard linked from the content-addressable store to the virtual store.
Content-addressable store is at: /home/hasezoey/Downloads/shared/.pnpm-store/v3
Virtual store is at: node_modules/.pnpm
Progress: resolved 400, reused 60, downloaded 0, added 45
Progress: resolved 400, reused 171, downloaded 0, added 159
Progress: resolved 400, reused 268, downloaded 0, added 261
Progress: resolved 400, reused 366, downloaded 0, added 354
Progress: resolved 400, reused 399, downloaded 0, added 397
.../node_modules/mongodb-memory-server postinstall$ node ./postinstall.js
Progress: resolved 400, reused 400, downloaded 0, added 400, done
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.436Z MongoMS:ResolveConfig findPackageJson: Found package.json at "/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/package.json"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.438Z MongoMS:MongoBinary getPath
.../node_modules/mongodb-memory-server postinstall: Mongodb-Memory-Server* checking MongoDB binaries
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.440Z MongoMS:getos getLinuxInformation: Using UpstreamLSB
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.440Z MongoMS:DryMongoBinary generateDownloadPath: Generating Download Path, preferGlobal: "true"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.442Z MongoMS:DryMongoBinary generateDownloadPath: Paths: {
.../node_modules/mongodb-memory-server postinstall: legacyHomeCache: '',
.../node_modules/mongodb-memory-server postinstall: modulesCache: '/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/mongod-x64-ubuntu-4.0.25',
.../node_modules/mongodb-memory-server postinstall: relative: '/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.pnpm/[email protected]/node_modules/mongodb-memory-server/mongodb-binaries/mongod-x64-ubuntu-4.0.25',
.../node_modules/mongodb-memory-server postinstall: resolveConfig: ''
.../node_modules/mongodb-memory-server postinstall: }
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.444Z MongoMS:DryMongoBinary generateDownloadPath: no existing binary for version "4.0.25" was found
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.444Z MongoMS:DryMongoBinary generateDownloadPath: using modulesCache "/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/mongod-x64-ubuntu-4.0.25"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.444Z MongoMS:MongoBinary getPath: MongoBinary options: {
.../node_modules/mongodb-memory-server postinstall: "version": "4.0.25",
.../node_modules/mongodb-memory-server postinstall: "downloadDir": "/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server",
.../node_modules/mongodb-memory-server postinstall: "os": {
.../node_modules/mongodb-memory-server postinstall: "os": "linux",
.../node_modules/mongodb-memory-server postinstall: "dist": "ubuntu",
.../node_modules/mongodb-memory-server postinstall: "codename": "focal",
.../node_modules/mongodb-memory-server postinstall: "release": "20.04"
.../node_modules/mongodb-memory-server postinstall: },
.../node_modules/mongodb-memory-server postinstall: "arch": "x64",
.../node_modules/mongodb-memory-server postinstall: "systemBinary": "",
.../node_modules/mongodb-memory-server postinstall: "platform": "linux",
.../node_modules/mongodb-memory-server postinstall: "checkMD5": false
.../node_modules/mongodb-memory-server postinstall: }
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.444Z MongoMS:DryMongoBinary locateBinary: Trying to locate Binary for version "4.0.25"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.444Z MongoMS:DryMongoBinary generateDownloadPath: Generating Download Path, preferGlobal: "true"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.445Z MongoMS:DryMongoBinary generatePaths: resolveConfigValue is not empty
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.445Z MongoMS:DryMongoBinary generateDownloadPath: Paths: {
.../node_modules/mongodb-memory-server postinstall: legacyHomeCache: '',
.../node_modules/mongodb-memory-server postinstall: modulesCache: '/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/mongod-x64-ubuntu-4.0.25',
.../node_modules/mongodb-memory-server postinstall: relative: '/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.pnpm/[email protected]/node_modules/mongodb-memory-server/mongodb-binaries/mongod-x64-ubuntu-4.0.25',
.../node_modules/mongodb-memory-server postinstall: resolveConfig: '/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/mongod-x64-ubuntu-4.0.25'
.../node_modules/mongodb-memory-server postinstall: }
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.446Z MongoMS:DryMongoBinary generateDownloadPath: no existing binary for version "4.0.25" was found
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.446Z MongoMS:DryMongoBinary generateDownloadPath: using resolveConfig (DOWNLOAD_DIR) "/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/mongod-x64-ubuntu-4.0.25"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.446Z MongoMS:DryMongoBinary locateBinary: running generateDownloadPath
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.446Z MongoMS:DryMongoBinary generateDownloadPath: Generating Download Path, preferGlobal: "true"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.447Z MongoMS:DryMongoBinary generatePaths: resolveConfigValue is not empty
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.447Z MongoMS:DryMongoBinary generateDownloadPath: Paths: {
.../node_modules/mongodb-memory-server postinstall: legacyHomeCache: '',
.../node_modules/mongodb-memory-server postinstall: modulesCache: '/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/mongod-x64-ubuntu-4.0.25',
.../node_modules/mongodb-memory-server postinstall: relative: '/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.pnpm/[email protected]/node_modules/mongodb-memory-server/mongodb-binaries/mongod-x64-ubuntu-4.0.25',
.../node_modules/mongodb-memory-server postinstall: resolveConfig: '/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/mongod-x64-ubuntu-4.0.25'
.../node_modules/mongodb-memory-server postinstall: }
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.447Z MongoMS:DryMongoBinary generateDownloadPath: no existing binary for version "4.0.25" was found
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.447Z MongoMS:DryMongoBinary generateDownloadPath: using resolveConfig (DOWNLOAD_DIR) "/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/mongod-x64-ubuntu-4.0.25"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.447Z MongoMS:DryMongoBinary locateBinary: could not find an existing binary
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.448Z MongoMS:MongoBinary getPath: "RUNTIME_DOWNLOAD" is "true", trying to download
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.448Z MongoMS:MongoBinary download
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.450Z MongoMS:MongoBinary download: Waiting to acquire Download lock for file "/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/4.0.25.lock"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.450Z MongoMS:LockFile lock: Locking file "/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/4.0.25.lock"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.451Z MongoMS:LockFile checkLock: for file "/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/4.0.25.lock" with uuid: "undefined"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.451Z MongoMS:LockFile createLock: trying to create a lock file for "/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/4.0.25.lock"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.455Z MongoMS:LockFile createLock: Lock File Created for file "/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/4.0.25.lock"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.455Z MongoMS:MongoBinary download: Download lock acquired
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.455Z MongoMS:MongoBinary download: Adding version 4.0.25 to cache
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.456Z MongoMS:MongoBinaryDownload getMongodPath
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.456Z MongoMS:DryMongoBinary generateDownloadPath: Generating Download Path, preferGlobal: "true"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.456Z MongoMS:DryMongoBinary generatePaths: resolveConfigValue is not empty
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.456Z MongoMS:DryMongoBinary generateDownloadPath: Paths: {
.../node_modules/mongodb-memory-server postinstall: legacyHomeCache: '',
.../node_modules/mongodb-memory-server postinstall: modulesCache: '/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/mongod-x64-ubuntu-4.0.25',
.../node_modules/mongodb-memory-server postinstall: relative: '/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.pnpm/[email protected]/node_modules/mongodb-memory-server/mongodb-binaries/mongod-x64-ubuntu-4.0.25',
.../node_modules/mongodb-memory-server postinstall: resolveConfig: '/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/mongod-x64-ubuntu-4.0.25'
.../node_modules/mongodb-memory-server postinstall: }
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.458Z MongoMS:DryMongoBinary generateDownloadPath: no existing binary for version "4.0.25" was found
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.458Z MongoMS:DryMongoBinary generateDownloadPath: using resolveConfig (DOWNLOAD_DIR) "/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/mongod-x64-ubuntu-4.0.25"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.459Z MongoMS:MongoBinaryDownload startDownload
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.461Z MongoMS:DryMongoBinary generateDownloadPath: Generating Download Path, preferGlobal: "true"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.462Z MongoMS:DryMongoBinary generateDownloadPath: Paths: {
.../node_modules/mongodb-memory-server postinstall: legacyHomeCache: '',
.../node_modules/mongodb-memory-server postinstall: modulesCache: '/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/mongod-x64-ubuntu-4.0.25',
.../node_modules/mongodb-memory-server postinstall: relative: '/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.pnpm/[email protected]/node_modules/mongodb-memory-server/mongodb-binaries/mongod-x64-ubuntu-4.0.25',
.../node_modules/mongodb-memory-server postinstall: resolveConfig: ''
.../node_modules/mongodb-memory-server postinstall: }
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.463Z MongoMS:DryMongoBinary generateDownloadPath: no existing binary for version "4.0.25" was found
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.463Z MongoMS:DryMongoBinary generateDownloadPath: using modulesCache "/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/mongod-x64-ubuntu-4.0.25"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.465Z MongoMS:MongoBinaryDownloadUrl getUbuntuVersionString: ubuntuYear is "20", which dosnt have an "<=4.3.x" version, defaulting to "1804"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.465Z MongoMS:MongoBinaryDownloadUrl Using "mongodb-linux-x86_64-ubuntu1804-4.0.25.tgz" as the Archive String
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.465Z MongoMS:MongoBinaryDownloadUrl Using "https://fastdl.mongodb.org" as the mirror
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.466Z MongoMS:MongoBinaryDownload download
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.466Z MongoMS:MongoBinaryDownload download: Downloading: "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.0.25.tgz"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.467Z MongoMS:MongoBinaryDownload httpDownload
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:33.467Z MongoMS:MongoBinaryDownload httpDownload: trying to download "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.0.25.tgz"
.../node_modules/mongodb-memory-server postinstall: Downloading MongoDB "4.0.25": 0% (0mb / 100.1mb)
.../node_modules/mongodb-memory-server postinstall: Downloading MongoDB "4.0.25": 24.8% (24.8mb / 100.1mb)
.../node_modules/mongodb-memory-server postinstall: Downloading MongoDB "4.0.25": 50.3% (50.4mb / 100.1mb)
.../node_modules/mongodb-memory-server postinstall: Downloading MongoDB "4.0.25": 75.9% (75.9mb / 100.1mb)
.../node_modules/mongodb-memory-server postinstall: Downloading MongoDB "4.0.25": 100% (100.1mb / 100.1mb)
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:41.904Z MongoMS:MongoBinaryDownload httpDownload: moved "/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/mongodb-linux-x86_64-ubuntu1804-4.0.25.tgz.downloading" to "/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/mongodb-linux-x86_64-ubuntu1804-4.0.25.tgz"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:41.904Z MongoMS:MongoBinaryDownload makeMD5check: Checking MD5 of downloaded binary...
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:41.904Z MongoMS:MongoBinaryDownload makeMD5check: checkMD5 is disabled
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:41.904Z MongoMS:MongoBinaryDownload extract
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:41.904Z MongoMS:DryMongoBinary generateDownloadPath: Generating Download Path, preferGlobal: "true"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:41.905Z MongoMS:DryMongoBinary generatePaths: resolveConfigValue is not empty
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:41.905Z MongoMS:DryMongoBinary generateDownloadPath: Paths: {
.../node_modules/mongodb-memory-server postinstall: legacyHomeCache: '',
.../node_modules/mongodb-memory-server postinstall: modulesCache: '/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/mongod-x64-ubuntu-4.0.25',
.../node_modules/mongodb-memory-server postinstall: relative: '/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.pnpm/[email protected]/node_modules/mongodb-memory-server/mongodb-binaries/mongod-x64-ubuntu-4.0.25',
.../node_modules/mongodb-memory-server postinstall: resolveConfig: '/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/mongod-x64-ubuntu-4.0.25'
.../node_modules/mongodb-memory-server postinstall: }
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:41.907Z MongoMS:DryMongoBinary generateDownloadPath: no existing binary for version "4.0.25" was found
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:41.907Z MongoMS:DryMongoBinary generateDownloadPath: using resolveConfig (DOWNLOAD_DIR) "/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/mongod-x64-ubuntu-4.0.25"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:41.907Z MongoMS:MongoBinaryDownload extract: archive: "/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/mongodb-linux-x86_64-ubuntu1804-4.0.25.tgz" final: "/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/mongod-x64-ubuntu-4.0.25"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:41.909Z MongoMS:MongoBinaryDownload extractTarGz
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:44.051Z MongoMS:MongoBinary download: Removing Download lock
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:44.051Z MongoMS:LockFile unlock: Unlocking file "/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/4.0.25.lock"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:44.051Z MongoMS:LockFile checkLock: for file "/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/4.0.25.lock" with uuid: "512b9383-e144-44af-a28a-4f4d498af611"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:44.054Z MongoMS:LockFile checkLock: Lock File Already exists, and is for *this* process, with uuid: "512b9383-e144-44af-a28a-4f4d498af611"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:44.054Z MongoMS:LockFile unlock: Lock Status was "availableInstance" for file "/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/4.0.25.lock"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:44.054Z MongoMS:LockFile unlockCleanup: for file "/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/4.0.25.lock"
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:44.055Z MongoMS:MongoBinary download: Download lock removed
.../node_modules/mongodb-memory-server postinstall: 2021-06-28T14:08:44.055Z MongoMS:MongoBinary getPath: Mongod binary path: "/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/mongod-x64-ubuntu-4.0.25"
.../node_modules/mongodb-memory-server postinstall: Mongodb-Memory-Server* found binary: "/home/hasezoey/Downloads/shared/mongodb-memory-server-issue-489/node_modules/.cache/mongodb-memory-server/mongod-x64-ubuntu-4.0.25"
.../node_modules/mongodb-memory-server postinstall: Done
I couldn't find a value type on the documentation so I assumed it was accepting a boolean value.
thanks for providing, i guess i never considered that in the package.json values other than strings will be defined, will be fixed (i hope i dont forget it)
after some further investigation (and thinking), i would say that pnpm would need an special case in path resolving, which i would like to not do (i would like to keep it as generic as possible, without special cases)
and since 7.0.0-beta.50, the PREFER_GLOBAL_PATH option should now actually work (i tested it in the vm)
TL;DR: as long as pnpm will keep this structure, the only real fixes would be:
DOWNLOAD_DIR to direct the download to another directory (should be absolute)PREFER_GLOBAL_PATH to install it into ~/.cache/mongodb-binaries (this option should be preferred)Alrighty. I just upgraded MongoMS to 7.0.0-beta.51 and seems like in this version, I didn't even have to set config.mongodbMemoryServer to any package.json file and by looking at the results, I understand that MongoMS is now downloading and using the binary from temp folder- which I assume it is the default behavior of using preferGlobalPath option.
$ MONGOMS_DEBUG=1 pnpm test
> @mongodb-memory-server-issue-489/[email protected] test C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\packages\my-app
> jest
MongoMS:ResolveConfig findPackageJson: Found package.json at "C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\packages\my-app\package.json" +0ms
MongoMS:ResolveConfig findPackageJson: Found package.json at "C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\package.json" +4ms
MongoMS:MongoMemoryServer create: Called .create() method +0ms
MongoMS:MongoMemoryServer start: Called .start() method +1ms
MongoMS:MongoMemoryServer _startUpInstance: Called MongoMemoryServer._startUpInstance() method +2ms
MongoMS:MongoMemoryServer getStartOptions +1ms
MongoMS:MongoMemoryServer _startUpInstance: Creating new MongoDB instance with options: {"instance":{"port":54395,"dbName":"","ip":"127.0.0.1","storageEngine":"ephemeralForTest","dbPath":"C:\\Users\\Sahin\\AppData\\Local\\Temp\\mongo-mem--11200-I0dSVe78SZQ8","tmpDir":{"name":"C:\\Users\\Sahin\\AppData\\Local\\Temp\\mongo-mem--11200-I0dSVe78SZQ8"}}} +9ms
MongoMS:MongoInstance create: Called .create() method +0ms
MongoMS:MongoInstance Mongo[54395]: start +2ms
MongoMS:MongoBinary getPath +0ms
MongoMS:DryMongoBinary generateDownloadPath: Generating Download Path, preferGlobal: "true" +0ms
MongoMS:DryMongoBinary generateDownloadPath: Paths: {
legacyHomeCache: 'C:\\Users\\Sahin\\.cache\\mongodb-binaries\\mongod-x64-win32-4.0.25.exe',
modulesCache: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\node_modules\\.cache\\mongodb-memory-server\\mongod-x64-win32-4.0.25.exe',
relative: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\mongodb-binaries\\mongod-x64-win32-4.0.25.exe',
resolveConfig: ''
} +3ms
MongoMS:DryMongoBinary generateDownloadPath: Found binary in legacyHomeCache: "C:\Users\Sahin\.cache\mongodb-binaries\mongod-x64-win32-4.0.25.exe" +18ms
MongoMS:MongoBinary getPath: MongoBinary options: {
"version": "4.0.25",
"downloadDir": "C:\\Users\\Sahin\\.cache\\mongodb-binaries",
"os": {
"os": "win32"
},
"arch": "x64",
"systemBinary": "",
"platform": "win32",
"checkMD5": false
} +24ms
MongoMS:DryMongoBinary locateBinary: Trying to locate Binary for version "4.0.25" +4ms
MongoMS:DryMongoBinary generateDownloadPath: Generating Download Path, preferGlobal: "true" +2ms
MongoMS:DryMongoBinary generatePaths: resolveConfigValue is not empty +2ms
MongoMS:DryMongoBinary generateDownloadPath: Paths: {
legacyHomeCache: 'C:\\Users\\Sahin\\.cache\\mongodb-binaries\\mongod-x64-win32-4.0.25.exe',
modulesCache: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\node_modules\\.cache\\mongodb-memory-server\\mongod-x64-win32-4.0.25.exe',
relative: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\mongodb-binaries\\mongod-x64-win32-4.0.25.exe',
resolveConfig: 'C:\\Users\\Sahin\\.cache\\mongodb-binaries\\mongod-x64-win32-4.0.25.exe'
} +1ms
MongoMS:DryMongoBinary generateDownloadPath: Found binary in resolveConfig (DOWNLOAD_DIR): "C:\Users\Sahin\.cache\mongodb-binaries\mongod-x64-win32-4.0.25.exe" +2ms
MongoMS:DryMongoBinary locateBinary: running generateDownloadPath +2ms
MongoMS:DryMongoBinary generateDownloadPath: Generating Download Path, preferGlobal: "true" +1ms
MongoMS:DryMongoBinary generatePaths: resolveConfigValue is not empty +2ms
MongoMS:DryMongoBinary generateDownloadPath: Paths: {
legacyHomeCache: 'C:\\Users\\Sahin\\.cache\\mongodb-binaries\\mongod-x64-win32-4.0.25.exe',
modulesCache: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\node_modules\\.cache\\mongodb-memory-server\\mongod-x64-win32-4.0.25.exe',
relative: 'C:\\Users\\Sahin\\projects\\temp\\mongodb-memory-server-issue-x\\packages\\my-app\\mongodb-binaries\\mongod-x64-win32-4.0.25.exe',
resolveConfig: 'C:\\Users\\Sahin\\.cache\\mongodb-binaries\\mongod-x64-win32-4.0.25.exe'
} +1ms
MongoMS:DryMongoBinary generateDownloadPath: Found binary in resolveConfig (DOWNLOAD_DIR): "C:\Users\Sahin\.cache\mongodb-binaries\mongod-x64-win32-4.0.25.exe" +3ms
MongoMS:DryMongoBinary locateBinary: found binary at "C:\Users\Sahin\.cache\mongodb-binaries\mongod-x64-win32-4.0.25.exe" +1ms
MongoMS:MongoBinary getPath: Mongod binary path: "C:\Users\Sahin\.cache\mongodb-binaries\mongod-x64-win32-4.0.25.exe" +21ms
MongoMS:MongoInstance Mongo[54395]: start: Starting Processes +49ms
MongoMS:MongoInstance Mongo[54395]: _launchMongod: Launching Mongod Process +1ms
MongoMS:MongoInstance Mongo[54395]: prepareCommandArgs +1ms
MongoMS:MongoInstance Mongo[54395]: prepareCommandArgs: final arugment array:["--port","54395","--dbpath","C:\\Users\\Sahin\\AppData\\Local\\Temp\\mongo-mem--11200-I0dSVe78SZQ8","--storageEngine","ephemeralForTest","--bind_ip","127.0.0.1","--noauth"] +1ms
MongoMS:MongoInstance Mongo[54395]: _launchKiller: Launching Killer Process (parent: 11200, child: 19788) +8ms
MongoMS:MongoInstance Mongo[54395]: stdoutHandler: ""2021-06-29T18:41:18.601+0300 I CONTROL
[main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols
'none'"" +120ms
MongoMS:MongoInstance Mongo[54395]: stdoutHandler: ""2021-06-29T18:41:18.606+0300 I CONTROL
[initandlisten] MongoDB starting : pid=19788 port=54395 dbpath=C:\Users\Sahin\AppData\Local\Temp\mongo-mem--11200-I0dSVe78SZQ8 64-bit host=Sahin-NB
MongoMS:MongoInstance 2021-06-29T18:41:18.606+0300 I CONTROL [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
MongoMS:MongoInstance 2021-06-29T18:41:18.606+0300 I CONTROL [initandlisten] db version v4.0.25
MongoMS:MongoInstance 2021-06-29T18:41:18.606+0300 I CONTROL [initandlisten] git version: 89306fde6167fa12ea6e30d61e05791e8e214e55"" +4ms
MongoMS:MongoInstance Mongo[54395]: stdoutHandler: ""2021-06-29T18:41:18.606+0300 I CONTROL
[initandlisten] allocator: tcmalloc
MongoMS:MongoInstance 2021-06-29T18:41:18.606+0300 I CONTROL [initandlisten] modules: none
MongoMS:MongoInstance 2021-06-29T18:41:18.606+0300 I CONTROL [initandlisten] build environment:
MongoMS:MongoInstance 2021-06-29T18:41:18.606+0300 I CONTROL [initandlisten] distmod: 2008plus-ssl
MongoMS:MongoInstance 2021-06-29T18:41:18.606+0300 I CONTROL [initandlisten] distarch: x86_64
MongoMS:MongoInstance 2021-06-29T18:41:18.606+0300 I CONTROL [initandlisten] target_arch: x86_64
MongoMS:MongoInstance 2021-06-29T18:41:18.606+0300 I CONTROL [initandlisten] options: { net: { bindIp: "127.0.0.1", port: 54395 }, security: { authorization: "disabled" }, storage: { dbPath: "C:\Users\Sahin\AppData\Local\Temp\mongo-mem--11200-I0dSVe78SZQ8", engine: "ephemeralForTest" } }"" +3ms
MongoMS:MongoInstance Mongo[54395]: stdoutHandler: ""2021-06-29T18:41:18.613+0300 I CONTROL
[initandlisten]
MongoMS:MongoInstance 2021-06-29T18:41:18.613+0300 I CONTROL [initandlisten] ** NOTE: The ephemeralForTest storage engine is for testing only."" +4ms
MongoMS:MongoInstance Mongo[54395]: stdoutHandler: ""2021-06-29T18:41:18.613+0300 I CONTROL
[initandlisten] ** Do not use in production.
MongoMS:MongoInstance 2021-06-29T18:41:18.613+0300 I CONTROL [initandlisten]
MongoMS:MongoInstance 2021-06-29T18:41:18.614+0300 I STORAGE [initandlisten] createCollection: admin.system.version with provided UUID: 662847c8-41a7-4eb5-941e-a8034b912467"" +2ms
MongoMS:MongoInstance Mongo[54395]: stdoutHandler: ""2021-06-29T18:41:18.615+0300 I SHARDING
[initandlisten] Marking collection admin.system.version as collection version: <unsharded>
MongoMS:MongoInstance 2021-06-29T18:41:18.615+0300 I COMMAND [initandlisten] setting featureCompatibilityVersion to 4.0
MongoMS:MongoInstance 2021-06-29T18:41:18.616+0300 I SHARDING [initandlisten] Marking collection local.system.replset as collection version: <unsharded>
MongoMS:MongoInstance 2021-06-29T18:41:18.616+0300 I SHARDING [initandlisten] Marking collection admin.system.roles as collection version: <unsharded>
MongoMS:MongoInstance 2021-06-29T18:41:18.617+0300 I STORAGE [initandlisten] createCollection: local.startup_log with generated UUID: a3f415ee-eabb-4f6f-8059-696ee1cef9e4
MongoMS:MongoInstance 2021-06-29T18:41:18.617+0300 I SHARDING [initandlisten] Marking collection local.startup_log as collection version: <unsharded>"" +2ms
MongoMS:MongoInstance Mongo[54395]: stdoutHandler: ""2021-06-29T18:41:18.976+0300 I FTDC
[initandlisten] Initializing full-time diagnostic data capture with directory 'C:/Users/Sahin/AppData/Local/Temp/mongo-mem--11200-I0dSVe78SZQ8/diagnostic.data'"" +359ms
MongoMS:MongoInstance Mongo[54395]: stdoutHandler: ""2021-06-29T18:41:18.980+0300 I SHARDING
[LogicalSessionCacheRefresh] Marking collection config.system.sessions as collection version: <unsharded>"" +4ms
MongoMS:MongoInstance Mongo[54395]: stdoutHandler: ""2021-06-29T18:41:18.980+0300 I CONTROL
[LogicalSessionCacheReap] Sessions collection is not set up; waiting until next sessions reap interval: config.system.sessions does not exist
MongoMS:MongoInstance 2021-06-29T18:41:18.980+0300 I STORAGE [LogicalSessionCacheRefresh] createCollection: config.system.sessions with generated UUID: 6a2f9671-d9d4-469b-a1a5-8d097b8d8325
MongoMS:MongoInstance 2021-06-29T18:41:18.981+0300 I NETWORK [initandlisten] waiting for connections on port 54395
MongoMS:MongoInstance 2021-06-29T18:41:18.981+0300 I INDEX [LogicalSessionCacheRefresh] build index on: config.system.sessions properties: { v: 2, key: { lastUse: 1 }, name: "lsidTTLIndex", ns: "config.system.sessions", expireAfterSeconds: 1800 }
MongoMS:MongoInstance 2021-06-29T18:41:18.981+0300 I INDEX [LogicalSessionCacheRefresh]
building index using bulk method; build may temporarily use up to 500 megabytes of RAM
MongoMS:MongoInstance 2021-06-29T18:41:18.981+0300 I INDEX [LogicalSessionCacheRefresh] build index done. scanned 0 total records. 0 secs"" +2ms
MongoMS:MongoInstance Mongo[54395]: constructor: Instance is ready! +4ms
MongoMS:MongoInstance Mongo[54395]: start: Processes Started +1ms
MongoMS:MongoMemoryServer _startUpInstance: Instance Started +570ms
MongoMS:MongoMemoryServer start: Instance fully Started +1ms
MongoMS:MongoMemoryServer getUri: running +1ms
MongoMS:MongoInstance Mongo[54395]: stdoutHandler: ""2021-06-29T18:41:19.003+0300 I NETWORK
[listener] connection accepted from 127.0.0.1:54398 #1 (1 connection now open)"" +23ms
MongoMS:MongoInstance Mongo[54395]: stdoutHandler: ""2021-06-29T18:41:19.010+0300 I NETWORK
[conn1] received client metadata from 127.0.0.1:54398 conn1: { driver: { name: "nodejs|Mongoose", version: "3.6.8" }, os: { type: "Windows_NT", name: "win32", architecture: "x64", version: "10.0.19043" }, platform: "'Node.js v16.3.0, LE (unified)", version: "3.6.8|5.13.0" }"" +12ms
MongoMS:MongoInstance Mongo[54395]: stdoutHandler: ""2021-06-29T18:41:19.022+0300 I NETWORK
[listener] connection accepted from 127.0.0.1:58072 #2 (2 connections now open)"" +3ms
MongoMS:MongoInstance Mongo[54395]: stdoutHandler: ""2021-06-29T18:41:19.025+0300 I NETWORK
[conn2] received client metadata from 127.0.0.1:58072 conn2: { driver: { name: "nodejs|Mongoose", version: "3.6.8" }, os: { type: "Windows_NT", name: "win32", architecture: "x64", version: "10.0.19043" }, platform: "'Node.js v16.3.0, LE (unified)", version: "3.6.8|5.13.0" }"" +5ms
MongoMS:MongoMemoryServer stop: Called .stop() method +50ms
MongoMS:MongoMemoryServer stop: Stopping MongoDB server on port 54395 with pid 19788 +1ms
MongoMS:MongoInstance Mongo[54395]: stop +12ms
MongoMS:utils killProcess: mongodProcess: sending "SIGINT" +0ms
MongoMS:MongoInstance Mongo[54395]: stdoutHandler: ""2021-06-29T18:41:19.037+0300 I NETWORK
[conn1] end connection 127.0.0.1:54398 (1 connection now open)
MongoMS:MongoInstance 2021-06-29T18:41:19.039+0300 I NETWORK [conn2] end connection 127.0.0.1:58072 (0 connections now open)"" +3ms
MongoMS:utils killProcess: mongodProcess: got exit signal, Code: null, Signal: SIGINT +24ms
MongoMS:MongoInstance Mongo[54395]: closeHandler: Mongod instance closed with an non-0 (or non 12 on windows) code! +23ms
MongoMS:MongoInstance Mongo[54395]: closeHandler: null +2ms
MongoMS:utils killProcess: killerProcess: sending "SIGINT" +4ms
MongoMS:utils killProcess: killerProcess: got exit signal, Code: null, Signal: SIGINT +6ms
MongoMS:MongoInstance Mongo[54395]: stop: Instance Finished Shutdown +7ms
MongoMS:MongoMemoryServer cleanup: force false +37ms
MongoMS:MongoMemoryServer cleanup: removing tmpDir at C:\Users\Sahin\AppData\Local\Temp\mongo-mem--11200-I0dSVe78SZQ8 +1ms
PASS test/dbConnection.spec.ts
Test DB connection
√ should failed to connect database (17 ms)
√ should connect database successfully (613 ms)
Test Suites: 1 passed, 1 total
Tests: 2 passed, 2 total
Snapshots: 0 total
Time: 3.974 s, estimated 4 s
Ran all test suites.
I can now consider this solved for my case at the moment. However, I'm also thinking about the future because the temp folder "dbPath":"C:\\Users\\Sahin\\AppData\\Local\\Temp\\mongo-mem--11200-I0dSVe78SZQ8" might get deleted in future by a cleanup functionality of OS or by a third-party software that cleans the temp folder. In that case, can we assume that running pnpm test in my case, will attempt to re-download the binary file?
I understand that MongoMS is now downloading and using the binary from temp folder- which I assume it is the default behavior of using preferGlobalPath option.
like i said earlier, this temporary directory is only for the DataBase Path, not the Binary or Download path
and preferGlobalPath will install it into the current users home directory (on POSIX systems, its ~/.cache/mongodb-binaries, and on DOS systems, its %USERPROFILE%/.cache/mongodb-binaries - both using os.homedir())
and as you can see by the output of
MongoMS:DryMongoBinary generateDownloadPath: Found binary in legacyHomeCache: "C:\Users\Sahin\.cache\mongodb-binaries\mongod-x64-win32-4.0.25.exe" +18ms
the binary is stored at C:\Users\Sahin\.cache\mongodb-binaries\mongod-x64-win32-4.0.25.exe
Oops, got it 👍
closing, because workaround (PREFER_GLOBAL_PATH) works and wontfix label
Thanks and I appreciate for looking into this problem and for the solutions @hasezoey