Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

extend works in windows

  • Loading branch information...
commit 425a8a653f2f9569df3c01dbe22de008e3124118 1 parent 175a66d
@mattyod authored
Showing with 10 additions and 6 deletions.
  1. +4 −3 bin/extend.js
  2. +6 −3 tests/extend.test.js
View
7 bin/extend.js
@@ -13,13 +13,14 @@
*/
-var fs = require('fs'),
- _ = require('underscore');
+var fs = require('fs'),
+ _ = require('underscore'),
+ path = require('path');
module.exports = function(config) {
// Build the config file path from the current process path
- var configPath = process.env.PWD + '/config.json';
+ var configPath = process.cwd() + path.sep + 'config.json';
// If there is a config.json file in the build folder
if(fs.existsSync(configPath)) {
View
9 tests/extend.test.js
@@ -1,6 +1,9 @@
// Tested module
var extend = require('../bin/extend.js');
+// helper moduls
+var path = require('path');
+
// Our expected extended object
var expectedResult = {
"test": "User mock config",
@@ -16,10 +19,10 @@ module.exports = {
};
// Store the process invokation path
- this.oldProcessPath = process.env.PWD;
+ this.oldProcessPath = process.cwd();
// Adjust the process invokation path to point into our test folder temporarily
- process.env.PWD += '/tests/testFiles';
+ process.chdir(process.cwd() + path.sep + 'tests' + path.sep + 'testFiles');
callback();
@@ -28,7 +31,7 @@ module.exports = {
tearDown: function(callback) {
// Restore the process invokation path
- process.env.PWD = this.oldProcessPath;
+ process.chdir(this.oldProcessPath);
callback();
Please sign in to comment.
Something went wrong with that request. Please try again.