39 Commits

Author SHA1 Message Date
Huáng Jùnliàng
164a93945d
add showConfig support (#11588)
* draft: showConfig support

* feat: pass through showConfig command options

* update test file

* refactor: add createLogger to makeChainWalker

* serializing dynamic plugin instance

* fix flow errors

* chore: add tests on extended config

* fix: do not print empty presets

* add more test cases

* add windows testcases

* address review comments

* throw error when showConfigPath does not exist

* print reason when showConfig is targetting an ignored file

* remove showConfig: boolean

* refactor: simplify environment flag name

* rename test fixtures

* fix: throw when SHOW_CONFIG_FOR is not a regular file

* cleanup test fixtures

* add test on only

* Update packages/babel-core/src/config/files/configuration.js

Co-authored-by: Brian Ng <bng412@gmail.com>

* address review comments

* update test fixtures

* feat: sort config items in ascending priority

Co-authored-by: Brian Ng <bng412@gmail.com>
2020-07-30 09:24:19 -04:00
Bogdan Savluk
4108524856
Update prettier to v2 (#11579)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-06-07 22:21:33 +02:00
Nicolò Ribaudo
698fe8ef50
Log after subsequent compilations in --watch mode (#11220) 2020-05-24 23:03:22 +02:00
Nicolò Ribaudo
92c6807ae8
[@babel/cli] Copy ignored files by default (#11063)
This commit restores the pre-7.8.0 behavior of the --copy-files option, by making
--copy-ignored default to true when --copy-files is enabled.
2020-01-30 13:01:04 +01:00
Raja Sekar
8415065d99 --copy-ignored flag added to CLI (#10887)
* prevent ignored files in out dir

* added includeIgnore cli option

* Help text change

* Update packages/babel-cli/src/babel/options.js

Copy review.

Co-Authored-By: Brian Ng <bng412@gmail.com>

* review comments

* throw error if copyIgnored is used without ignore flag

* check for ignored files

* duplicate pathToPattern fn in babel/cli

* change implementation

* removed ignore option from cliOption

* added test case with ignore in config

* added test case with ignore in config

* review

Co-authored-by: Brian Ng <bng412@gmail.com>
2020-01-10 03:03:37 +01:00
Huáng Jùnliàng
a2b5437b01 chore: remove output-file-sync dependency (#10619) 2019-10-31 11:51:36 -07:00
Nicolò Ribaudo
686186cabc
Attemp fixing @babel/node and cli errors on Travis on Windows (#10547)
For some reason, it looks like that the rimraf call didn't properly delete
the folder:

   EEXIST: file already exists, mkdir 'C:\Users\travis\build\babel\babel\packages\babel-node\test\tmp'
      150 |   process.chdir(__dirname);
      151 |   if (fs.existsSync(tmpLoc)) rimraf.sync(tmpLoc);
    > 152 |   fs.mkdirSync(tmpLoc);
          |      ^
      153 |   process.chdir(tmpLoc);
      154 | };

Lets try to reuse the existing folder rather than deleting and recreating it
2019-10-15 23:00:23 +02:00
Nicolò Ribaudo
b459f6a0a4
Add windows to travis (#10249)
* Add windows to travis

* Update

* Do not use sh file on windows

* Fix whitespace

* Unify command

* ./ doesn't work on windows

* Remove all ./ usages

* Run windows test before others

* fix: normalize filename when generating sources

sources should be URL.

* fix: replace normalized path to cwd

* chore: add nodePlatform task options

* fix: normalize preset-env filename output

* chore: replace normalized path to CWD on win32 platform

* limit transform-react-source to run on linux and darwin

* test: escapeRegExp on testcases

* test: add test for babel --filename on windows

* test: double babel-node/cli test timeout

* chore: workaround windows build does not stop

* chore: remove redundant condition

* refactor: rename `nodePlatform` to `os`
2019-09-26 20:59:17 +02:00
Daniel Tschinder
4f0840ab88
Update dev dependencies and fix linting errors (#10228)
* chore: Uppate dev dependencies

* chore: Fix lint errors

* chore: Format options.json files

* chore: Fix stupid flow errors

* Update test262 whitelist

Seems test262-stream was updated and now these tests work.
2019-07-27 15:09:30 +02:00
Letladi Sebesho
31fc1d06bc Babel cli test correction (#10128) 2019-06-25 15:38:32 -05:00
Henry Zhu
10910a10f5
Remove yearly presets from repo, inline in standalone (#8274)
These were already deprecated in v6, just didn't remove the folders?
2018-07-09 14:23:25 -04:00
Logan Smyth
53e4d74ebe
Treat all filenames as absolute paths. (#8044) 2018-05-24 20:56:19 -07:00
Sven SAULEAU
52b800decb Add no-babelrc option in babel-node (#5621)
<!-- 
Before making a PR please make sure to read our contributing guidelines 
https://github.com/babel/babel/blob/master/CONTRIBUTING.md

For any issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR
-->

| Q                        | A <!--(yes/no) -->
| ------------------------ | ---
| Patch: Bug Fix?          | 
| Major: Breaking Change?  | 
| Minor: New Feature?      | y
| Deprecations?            | 
| Spec Compliancy?         | 
| Tests Added/Pass?        | y/y
| Fixed Tickets            | #5616
| License                  | MIT
| Doc PR                   | <!-- if yes, add `[skip ci]` to your commit message to skip CI builds -->
| Dependency Changes       | 

<!-- Describe your changes below in as much detail as possible -->

Once merged I will make the corresponding documentation changes on the website (in a 7 branch)
2018-05-23 09:19:39 -07:00
Logan Smyth
69cca412eb
Make the filename option, as exposed to the plugins, consistently relative to the working directory (#7956)
| Q                        | A <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| Fixed Issues?            | 
| Patch: Bug Fix?          | Y
| Major: Breaking Change?  | N
| Minor: New Feature?      |
| Tests Added + Pass?      | Yes
| Documentation PR         | <!-- If so, add `[skip ci]` to your commit message to skip CI -->
| Any Dependency Changes?  |
| License                  | MIT

Currently the `opts.filename` value exposed to plugins is just whatever the user passed. While it _could_ be relative to the working directory, if Babel was passed an absolute URL, it'll be absolute.

This PR explicitly ensures the filename is a relative path based on the working directory. This also exposes an officially endorsed API for reading the working directory path.
2018-05-21 17:10:57 -07:00
Deven Bansod
95894397eb Migrate babel-cli and babel-generator tests to use jest-expect (#7549) 2018-04-11 13:12:56 -05:00
Daniel Tschinder
3e95830646
Migrate to jest (#7455) 2018-03-03 10:58:19 +01:00
Henry Zhu
9ac326b075
remove es20xx prefixes from plugins and rename folders (#6575) 2017-10-28 20:43:15 -04:00
Mateusz Burzyński
47fa189053 Scoped: update more babel- to @babel/ [skip ci] 2017-10-16 22:49:56 -04:00
Brian Ng
9cd4716cb4 Add --include-dotfiles option to babel-cli (#6232) 2017-10-02 08:55:53 -05:00
Pranav Prakash
2374062bbd Remove babel-node from babel-cli (#6251)
* Remove babel-node from babel-cli

* Use new Array instead of Array for V8 optimization

* Remove extraneous use strict clauses

* Require babel-node in babel-cli

* Remove babel-node from babel-cli

* Require babel-node in babel-cli

* Remove babel-node executable from babel-cli

* Clean up babel-node from package.json
2017-09-23 11:25:27 -07:00
Brian Ng
e4b35f680d
Run prettier 2017-06-27 12:15:00 -05:00
Logan Smyth
fa23b662c2 Add empty .babelrc for CLI tests. 2017-03-27 14:46:39 -07:00
Henry Zhu
3d74dc044f fix ci 2017-03-27 17:26:39 -04:00
Brian Ng
c687b703ae Ensure babel-cli tests compare generated output with out-files (#5205) 2017-03-23 12:06:56 -04:00
Logan Smyth
39c862c195 Make only/ignore relative to cwd/config file and move only/ignore checking all to core. (#5487)
* Make only/ignore relative to cwd/config file and move only/ignore checking all to core.
2017-03-16 23:22:43 -07:00
Brian Ng
8a82cc060a Run new lint rules (#5413) 2017-03-04 10:46:01 -05:00
Logan Smyth
b845f2b69d Re-enable the max-len ESLint rule. (#5265) 2017-02-04 11:07:15 -05:00
Andres Suarez
85b3aec747 Use native or lodash util module where full "lodash" is required 2017-01-15 13:35:00 -08:00
Henry Zhu
672adba9a1 enable prefer const (#5113) 2017-01-14 09:48:52 -05:00
Simen Bekkhus
9c2794dc85 Replace path-exists with fs.existsSync (#4731)
It's not deprecated anymore, see nodejs/node#8364
2016-10-17 14:31:49 -04:00
Andrew Levine
9f8ab29213 Change usage of "suite"/"test" in unit-tests to "describe"/"it" (#4734)
Fixes #4733
2016-10-15 18:45:35 -04:00
Andrew Levine
c0038221d7 Run ESLint on test files, and fix lint errors in test files (#4732) 2016-10-15 18:27:48 -04:00
Daniel Tschinder
1dca51f8ab Enable babel for tests (#4564)
* Enable babel for tests

This enables babel for tests by using a mocha compiler
It uses the babel config from package.json
Transformed OptionsManager test to es2015 to see if it works
Removed the 5s timeout from cli tests, as the default timeout is already 10s, this should probably fix the timouts on travis that we had in babylon
Also run the cli tests on travis, they were disabled if istanbul active, but istanbul is always active on travis so we were never running this tests.

* ignore scripts directory

* only register for tests

* Set only flag correctly
2016-10-12 10:56:50 +02:00
Daniel Tschinder
ff78fb19f7 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
2016-09-13 08:25:08 -04:00
Jordan Klassen
dc1f40540d Upgrade to lodash 4 (#3315)
* Upgrade to lodash 4

* Fix incorrect require in babel-runtime/scripts

* Replace cloneDeep with cloneDeepWith where applicable
2016-05-13 17:15:14 -04:00
Sebastian McKenzie
5f40b53dee abstract out test runner into a module, move traceur and esnext tests to babel-preset-es2015, clean up and make existing tests more consistent 2015-11-08 21:58:01 -08:00
Sebastian McKenzie
ae7d5367f1 6.0.0
I'm extremely stupid and didn't commit as I go. To anyone reading this
I'm extremely sorry. A lot of these changes are very broad and I plan on
releasing Babel 6.0.0 today live on stage at Ember Camp London so I'm
afraid I couldn't wait. If you're ever in London I'll buy you a beer
(or assorted beverage!) to make up for it, also I'll kiss your feet and
give you a back massage, maybe.
2015-10-29 17:51:24 +00:00
Sebastian McKenzie
b12866db86 extract out mocha fixtures and resolve utils 2015-07-25 03:54:48 +01:00
Sebastian McKenzie
fedf894904 Begin transition of Babel to a more scalable architecture, async flow to allow for RPC and better build system for multiple packages 2015-07-11 12:39:54 +01:00