Code coverage report for mongodb-version-manager/lib/config.js

Statements: 75% (12 / 16)      Branches: 25% (1 / 4)      Functions: 100% (0 / 0)      Lines: 75% (12 / 16)      Ignored: none     

All files » mongodb-version-manager/lib/ » config.js
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 26 27 28 291 1 1   1   1 1 1     1   1             1       1     1  
var path = require('path');
var fs = require('fs');
var untildify = require('untildify');
 
module.exports = {};
 
var dest;
var module_path = path.join(process.cwd(), 'node_modules', 'mongodb-version-manager');
Iif (process.env.MONGODB_VERSIONS) {
  dest = untildify(process.env.MONGODB_VERSIONS);
} else {
  try {
    /* eslint no-sync:0 */
    isLocal = fs.statSync(module_path).isDirectory();
    if (isLocal) {
      dest = path.join(process.cwd(), '.mongodb');
    } else {
      dest = untildify('~/.mongodb/versions');
    }
  } catch (err) {
    dest = untildify('~/.mongodb/versions');
  }
}
 
module.exports.cache = path.resolve(dest);
 
// expire versions cache page every hour
module.exports.expire = 60 * 60 * 1000;