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:
committed by
Henry Zhu
parent
993f887240
commit
ff78fb19f7
7
packages/babel-cli/test/fixtures/babel/filename --no-comments/in-files/script.js
vendored
Normal file
7
packages/babel-cli/test/fixtures/babel/filename --no-comments/in-files/script.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
Test comment
|
||||
*/
|
||||
|
||||
arr.map(x => x * MULTIPLIER);
|
||||
|
||||
// END OF FILE
|
||||
3
packages/babel-cli/test/fixtures/babel/filename --no-comments/options.json
vendored
Normal file
3
packages/babel-cli/test/fixtures/babel/filename --no-comments/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"args": ["script.js", "--out-file", "script2.js", "--no-comments"]
|
||||
}
|
||||
5
packages/babel-cli/test/fixtures/babel/filename --no-comments/out-files/script2.js
vendored
Normal file
5
packages/babel-cli/test/fixtures/babel/filename --no-comments/out-files/script2.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
arr.map(function (x) {
|
||||
return x * MULTIPLIER;
|
||||
});
|
||||
3
packages/babel-cli/test/fixtures/babel/filename babelrc no comments/.babelrc
vendored
Normal file
3
packages/babel-cli/test/fixtures/babel/filename babelrc no comments/.babelrc
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"comments": false
|
||||
}
|
||||
7
packages/babel-cli/test/fixtures/babel/filename babelrc no comments/in-files/script.js
vendored
Normal file
7
packages/babel-cli/test/fixtures/babel/filename babelrc no comments/in-files/script.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
Test comment
|
||||
*/
|
||||
|
||||
arr.map(x => x * MULTIPLIER);
|
||||
|
||||
// END OF FILE
|
||||
3
packages/babel-cli/test/fixtures/babel/filename babelrc no comments/options.json
vendored
Normal file
3
packages/babel-cli/test/fixtures/babel/filename babelrc no comments/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"args": ["script.js", "--out-file", "script2.js"]
|
||||
}
|
||||
5
packages/babel-cli/test/fixtures/babel/filename babelrc no comments/out-files/script2.js
vendored
Normal file
5
packages/babel-cli/test/fixtures/babel/filename babelrc no comments/out-files/script2.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
arr.map(function (x) {
|
||||
return x * MULTIPLIER;
|
||||
});
|
||||
7
packages/babel-cli/test/fixtures/babel/filename default comments/in-files/script.js
vendored
Normal file
7
packages/babel-cli/test/fixtures/babel/filename default comments/in-files/script.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
Test comment
|
||||
*/
|
||||
|
||||
arr.map(x => x * MULTIPLIER);
|
||||
|
||||
// END OF FILE
|
||||
3
packages/babel-cli/test/fixtures/babel/filename default comments/options.json
vendored
Normal file
3
packages/babel-cli/test/fixtures/babel/filename default comments/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"args": ["script.js", "--out-file", "script2.js"]
|
||||
}
|
||||
11
packages/babel-cli/test/fixtures/babel/filename default comments/out-files/script2.js
vendored
Normal file
11
packages/babel-cli/test/fixtures/babel/filename default comments/out-files/script2.js
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Test comment
|
||||
*/
|
||||
|
||||
arr.map(function (x) {
|
||||
return x * MULTIPLIER;
|
||||
});
|
||||
|
||||
// END OF FILE
|
||||
Reference in New Issue
Block a user