Skip to content

Commit

Permalink
Merge pull request #477 from opentable/get-components-by-dir-issue
Browse files Browse the repository at this point in the history
get-components-by-dir-issue
  • Loading branch information
matteofigus authored Apr 27, 2017
2 parents 16c9f24 + f8c0967 commit 0aa0340
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/cli/domain/get-components-by-dir.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ module.exports = function(){
return false;
}

if (!content.oc) {
return false;
}

const packagedProperty = content.oc && content.oc.packaged;

return _.isUndefined(packagedProperty);
Expand Down
4 changes: 3 additions & 1 deletion test/unit/cli-domain-get-components-by-dir.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ describe('cli : domain : get-components-by-dir', () => {
'a-component',
'a-not-component-dir',
'a-file.json',
'_package'
'_package',
'no-component-but-package-json'
]);

data.fs.readJsonSync.onCall(0).returns({ oc: {}});
data.fs.readJsonSync.onCall(1).throws(new Error('ENOENT: no such file or directory'));
data.fs.readJsonSync.onCall(2).throws(new Error('ENOENT: no such file or directory'));
data.fs.readJsonSync.onCall(3).returns({ oc: { packaged: true }});
data.fs.readJsonSync.onCall(4).returns({});

executeComponentsListingByDir(data.local, (err, res) => {
error = err;
Expand Down

0 comments on commit 0aa0340

Please sign in to comment.