Skip to content

Commit

Permalink
fix(cli): Allow absolute paths for config file - fixes #583
Browse files Browse the repository at this point in the history
  • Loading branch information
shakyShane committed Apr 29, 2015
1 parent 8b4d707 commit 8fcd904
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/cli/cli-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var info = {
* @param filePath
*/
getConfigFile: function (filePath) {
return require(path.resolve(process.cwd() + "/" + filePath));
return require(path.resolve(process.cwd(), filePath));
},
/**
* Generate an example Config file.
Expand Down
11 changes: 9 additions & 2 deletions test/specs/cli/cli.get.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"use strict";

var info = require("../../../lib/cli/cli-info");
var assert = require("chai").assert;
var info = require("../../../lib/cli/cli-info");
var assert = require("chai").assert;
var path = require("path");

describe("When reading a config file from the file system", function () {

Expand All @@ -14,4 +15,10 @@ describe("When reading a config file from the file system", function () {
it("should not throw if the file is found", function () {
assert.isDefined(info.getConfigFile("test/fixtures/config/si-config.js"));
});

it("should not throw if absolute path given", function () {

var configPath = path.resolve("test/fixtures/config/si-config.js");
assert.isDefined(info.getConfigFile(configPath));
});
});

0 comments on commit 8fcd904

Please sign in to comment.