Skip to content

Commit

Permalink
bug fix related in #2
Browse files Browse the repository at this point in the history
  • Loading branch information
ByIvo committed Jan 31, 2018
1 parent e8e64d1 commit 5e43d12
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/configfile_finder/configfile-finder-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ describe('Configfile finder', function () {
fs.readdirSync.restore();
});

it('If the file does not exists, throw an exception', function () {
expect(function () {
configfileFinder.from(fakeNoConfigfilePath, configFilename);
}).to.throw('The path \''+ path.join(fakeNoConfigfilePath, configFilename) + '\' does not exists');
it('If the file does not exists, just ignore it and return false', function () {
var projectInfo = configfileFinder.from(fakeNoConfigfilePath, configFilename);

expect(projectInfo).to.equal(false);
});

it('Should read the file as property object and returns it', function () {
Expand Down
17 changes: 9 additions & 8 deletions src/configfile_finder/configfile-finder.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@ function readProjectInfoAndKeepSearching(dirPath, configFilename, isFirstCall) {
base: configFilename
});

if(!fs.existsSync(configfilePath)) {
throw Error('The path \''+ configfilePath + '\' does not exists');
}
if(fs.existsSync(configfilePath)) {

var projectInfo = configfileReader.readFrom(configfilePath);

var projectInfo = configfileReader.readFrom(configfilePath);

projectInfo.root = isFirstCall;
projectInfo.branches = readChildrenFrom(dirPath, configFilename);
projectInfo.root = isFirstCall;
projectInfo.branches = readChildrenFrom(dirPath, configFilename);

return projectInfo;
return projectInfo;
} else {
return false;
}
}

function readChildrenFrom(dirPath, configFilename) {
Expand Down

0 comments on commit 5e43d12

Please sign in to comment.