Skip to content

Commit

Permalink
fix: check MongoBinary module presense in postinstall script
Browse files Browse the repository at this point in the history
  • Loading branch information
nodkz committed May 31, 2018
1 parent e23c62e commit 90a9d35
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ It helps to skip timeout setup `jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;`
when first test run hits MongoDB binary downloading to the cache.
*/

if (require.resolve('./lib/util/MongoBinary')) {
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...');
Expand Down

0 comments on commit 90a9d35

Please sign in to comment.