Browse Source

Fixed error when used passing '.' as root

Herbert Vojčík 10 years ago
parent
commit
3311bd4b31
2 changed files with 12 additions and 0 deletions
  1. 1 0
      lib/config-builder.js
  2. 11 0
      test/produce.js

+ 1 - 0
lib/config-builder.js

@@ -82,6 +82,7 @@ function queoeOfFilesToProcess(files, dirMap) {
 }
 
 exports.produceConfigObject = function (root, callback) {
+    root = path.resolve(root);
     eachConfigFile(root, function (err, filesAndDirs) {
         if (err) {
             callback(err);

+ 11 - 0
test/produce.js

@@ -21,6 +21,17 @@ describe('#produceConfigObject merging', function () {
         });
     });
 
+    it('should work root being \'.\'', function (done) {
+        process.chdir(fixture('single-local'));
+        builder.produceConfigObject('.', function (err, result) {
+            assert.ifError(err);
+            assert.deepEqual(result, {
+                config: {foo: {foo: "bar"}}
+            });
+            done();
+        });
+    });
+
     it('should fail if foo.amd.json is present and there is no foo', function (done) {
         builder.produceConfigObject(fixture('local-and-missing'), function (err, result) {
             assert.ok(err);