Use os.homedir to get home dir in tests
authorRaphael von der Grün <raphinesse@gmail.com>
Mon, 14 May 2018 17:11:36 +0000 (19:11 +0200)
committerRaphael von der Grün <raphinesse@gmail.com>
Mon, 14 May 2018 17:59:04 +0000 (19:59 +0200)
spec/create.spec.js

index 63b09b0..87d3aa8 100644 (file)
@@ -18,6 +18,7 @@
 */
 
 var fs = require('fs');
+var os = require('os');
 var path = require('path');
 
 var shell = require('shelljs');
@@ -39,11 +40,7 @@ var project = path.join(tmpDir, appName);
 CordovaLogger.get().setLevel(CordovaLogger.ERROR);
 
 // Global configuration paths
-var global_config_path = process.env.CORDOVA_HOME;
-if (!global_config_path) {
-    var HOME = process.env[(process.platform.slice(0, 3) === 'win') ? 'USERPROFILE' : 'HOME'];
-    global_config_path = path.join(HOME, '.cordova');
-}
+var global_config_path = process.env.CORDOVA_HOME || path.join(os.homedir(), '.cordova');
 
 // Setup and teardown test dirs
 beforeEach(function () {