forked from typegoose/mongodb-memory-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpostinstall.js
More file actions
25 lines (20 loc) · 742 Bytes
/
postinstall.js
File metadata and controls
25 lines (20 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
This script is used as postinstall hook.
When you install mongodb-memory-server package
npm or yarn downloads the latest version of mongodb binaries.
It helps to skip timeout setup `jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;`
when first test run hits MongoDB binary downloading to the cache.
*/
function isModuleExists(name) {
try { return !!require.resolve(name); }
catch(e) { return false }
}
if (isModuleExists('./lib/util/MongoBinary')) {
const MongoBinary = require('./lib/util/MongoBinary').default;
console.log('mongodb-memory-server: checking MongoDB binaries cache...');
MongoBinary.getPath({
version: 'latest',
}).then(binPath => {
console.log(`mongodb-memory-server: binary path is ${binPath}`);
});
}