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

@@ -0,0 +1,7 @@
/*
Test comment
*/
arr.map(x => x * MULTIPLIER);
// END OF FILE

View File

@@ -0,0 +1,3 @@
{
"args": ["script.js", "--out-file", "script2.js", "--no-comments"]
}

View File

@@ -0,0 +1,5 @@
"use strict";
arr.map(function (x) {
return x * MULTIPLIER;
});

View File

@@ -0,0 +1,3 @@
{
"comments": false
}

View File

@@ -0,0 +1,7 @@
/*
Test comment
*/
arr.map(x => x * MULTIPLIER);
// END OF FILE

View File

@@ -0,0 +1,3 @@
{
"args": ["script.js", "--out-file", "script2.js"]
}

View File

@@ -0,0 +1,5 @@
"use strict";
arr.map(function (x) {
return x * MULTIPLIER;
});

View File

@@ -0,0 +1,7 @@
/*
Test comment
*/
arr.map(x => x * MULTIPLIER);
// END OF FILE

View File

@@ -0,0 +1,3 @@
{
"args": ["script.js", "--out-file", "script2.js"]
}

View File

@@ -0,0 +1,11 @@
"use strict";
/*
Test comment
*/
arr.map(function (x) {
return x * MULTIPLIER;
});
// END OF FILE