Only set options in cli if different from default (#4507)

* CLI: Only set options if different from default 

Currently default values (like comments: true) will be set always for the transform.
This behaviour dos not allow for setting this options from babelrc as the default would always have precedence.

* Add new tests for comments
Also ensure that the babelrc in the fixture folder is copied over to the
working directory during tests
This commit is contained in:
Daniel Tschinder
2016-09-13 14:25:08 +02:00
committed by Henry Zhu
parent 993f887240
commit ff78fb19f7
12 changed files with 76 additions and 17 deletions

View File

@@ -107,7 +107,7 @@ if (errors.length) {
let opts = exports.opts = {};
each(options, function (opt, key) {
if (commander[key] !== undefined) {
if (commander[key] !== undefined && commander[key] !== opt.default) {
opts[key] = commander[key];
}
});