Skip to content
This repository was archived by the owner on Mar 4, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ Config.prototype._displayFields = function (field, archetypes) {
// Then, map in order.
return _.map(keys, function (key) {
var tasks = _.chain(pkgs)
.filter(function (pkg) { return pkg[field][key]; })
.filter(function (pkg) { return _.get(pkg, [field, key]); })
.map(function (pkg) {
return "\n " + chalk.gray("[" + pkg.name + "]") + " " + pkg[field][key];
return "\n " + chalk.gray("[" + pkg.name + "]") + " " + _.get(pkg, [field, key]);
})
.value()
.join("");
Expand Down
33 changes: 33 additions & 0 deletions test/server/spec/bin/builder-core.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,38 @@ describe("bin/builder-core", function () {
done();
});
});

// Regression test for: https://github.com/FormidableLabs/builder/issues/113
it("runs help with config in archetype", function (done) {
base.sandbox.spy(Task.prototype, "help");
base.mockFs({
".builderrc": "---\narchetypes:\n - mock-archetype",
"package.json": "{}",
"node_modules": {
"mock-archetype": {
"package.json": JSON.stringify({
"config": {
"_test_message": "from archetype"
}
}, null, 2)
}
}
});

run({
argv: ["node", "builder", "help"]
}, function (err) {
if (err) { return done(err); }

expect(Task.prototype.help).to.be.calledOnce;
expect(logStubs.info)
.to.be.calledWithMatch("Task Configs").and
.to.be.calledWithMatch("_test_message");

done();
});
});

});

describe("builder run", function () {
Expand Down Expand Up @@ -265,6 +297,7 @@ describe("bin/builder-core", function () {
});

}));

it("runs with quiet log output", stdioWrap(function (done) {
base.sandbox.spy(Task.prototype, "run");
base.mockFs({
Expand Down