Commit Graph

26 Commits (master)

Author SHA1 Message Date
Wei-Wei Wu 91c20f7fbe Rename "babylon" with "babel" (#5647) 2018-12-27 21:05:19 +08:00
Ika 4af3dd4b07
test: improve snapshots (#5521)
- before
  ```
  ${input}${"~".repeat(printWidth)}
  ${output}
  ```
- after
  ```
  ===options===
  ${options}
  ${" ".repeat(printWidth)}| printWidth
  ====input====
  ${input}
  ===output====
  ${output}
  =============
  ```
2018-11-25 16:21:14 +08:00
Christopher Chedeau 9910536b58
[unicode] Fix trailing nbsp (#5165)
I don't know why I added all the unicode whitespaces instead of just space and tabs, but it's not only unecessary but also wrong.

Fixes #5077
2018-09-29 15:22:13 -07:00
Simen Bekkhus 51b7c02e12 Upgrade jest to 22 (#4782)
* chore: upgrade Jest

* chore: update snapshots

* chore: lock down babel dependency using invalid syntax

* 2 args to test.skip

* use jest 22 for now

* Revert "2 args to test.skip"

This reverts commit 691fdc3f99e320f2303958f2b503f7b4c93fa455.

* remove snapshot name from matcher

* fix standalone tests skips
2018-07-03 03:06:29 -03:00
Lucas Duailibe f119d4a90f
Change run_spec to have explicit parser list (#3356) 2017-11-30 03:31:52 -03:00
Ika f009a96ae4 fix(doc-printer): use `string-width` (#3015)
* refactor(doc-printer): use `string-width`

* test: add test case
2017-10-12 02:27:02 -05:00
Lucas Azzola 2a58e6bc06 test(typescript): enable typescript-verify on most tests (#1781) 2017-05-27 17:57:07 -07:00
Brian Ng d608b7ba28 Bump Babylon and enable additional tests (#1668) 2017-05-22 15:31:53 -07:00
Christopher Chedeau 3161bd0787 Upgrade flow parser to 0.45 (#1447)
This fixes all the unicode issues and spacing between elements in array.

Fixes #1336
Fixes #1427
Fixes #770
2017-04-27 14:59:18 -07:00
Jan Kassens b82220b20f Prittier printing of snapshots (#1190)
This uses a custom snapshot serializer to reduce escaping in snapshot files and
make them easier to read.

Snapshot serializers are documented here:
https://facebook.github.io/jest/docs/configuration.html#snapshotserializers-array-string
2017-04-12 13:41:51 -07:00
Christopher Chedeau c3199359b0 Revert "Improve snapshot naming" (#1070)
* Revert "Remove mutation in `printBinaryishExpressions` (#1067)"

This reverts commit e7312ad7b2.

* Revert "Make it clear what parser was used in each snapshot (#1068)"

This reverts commit 4f7ae4815b.
2017-03-21 17:38:28 -07:00
ChristianHersevoort 4f7ae4815b Make it clear what parser was used in each snapshot (#1068) 2017-03-21 14:47:23 -07:00
Rogelio Guzman d45e157563 Upgrade to Jest 19 (#762)
* Upgrade to Jest 19

* Use exact versions for Jest
2017-02-21 13:59:19 -08:00
Christopher Chedeau 6a05a55852 Remove last trailing line for directives-only files (#609)
* Remove last trailing line for directives-only files

There are two hardlines that are added that do not need to.

- The first one is when there's an empty line afterwards, we want to remove it. The solution I opted for to fix this one is to trimRight the originalText so that globally it's never going to return yes for the isNextLineEmpty.
- The second one is at the end of Program, but we already printed it inside of the directive itself, so we can just add a condition to make sure it's only printed when there's a body or a comment, but not a directive.

Fixes #527

* Add comment
2017-02-07 10:39:04 -05:00
Christopher Chedeau 959235afd7 [RFC] Keep expanded objects expanded (#495)
Another attempt at solving the issue where objects are not expanded the way people expect. If there's any new line in the original source, it's going to expand it. This gives more control to the user in how the objects should be formatted.

Fixes #74
2017-01-30 09:08:55 -08:00
Christopher Chedeau 3375cfe605 Move tests around (#454)
* new_tests

* move_all_clobbered_tests

* remove all the tests that no longer exist

* re-run flow tests

* Move all the flow tests to tests/flow and prettier to tests/

* Move prettier tests to their own folders

* Add jsfmt files

* run prettier snapshot tests
2017-01-24 14:35:37 -08:00
Christopher Chedeau 080b7f8ec4 Swap quotes (#355)
- During the first iteration, we printed the unescaped values which let to printing invalid JavaScript characters and bad things like invisible characters.
- During the second iteration, we escaped everything, which generated valid JavaScript but you lost your emojis and chinese/cyrillic characters

In this iteration, which I hope will be the last one, we maintain the string exactly as encoded and only swap quotes. The swap quotes implementation is a bit convoluted but I think it works.
2017-01-20 14:47:52 -08:00
Christopher Chedeau 340da019d3 Add quotes around unicode keys in flow parser (#328)
There's a bug in the flow parser with keys using literal that contain unicode characters. Let's quote them for now.

Fixes #327
2017-01-19 12:37:24 -05:00
Christopher Chedeau 0192d58bc5 Preserve the way numbers were written (#257)
The goal of the pretty printer is to make sure that the indentation is correct, not to dictate how numbers should be written :)
2017-01-16 23:01:51 -05:00
James Long 00fad62c91 Regenerate snapshots 2017-01-11 10:16:38 -05:00
James Long a4643f1bae Add special case for comment at top of file; regenerate snapshots 2017-01-09 21:49:26 -05:00
James Long bcd44b4368 Keep blank lines from original source 2017-01-09 09:46:09 -05:00
James Long c9e24eb477 Add spaces around certain statements, add --write option, and more 2016-12-30 23:01:07 -05:00
James Long 88dc2681f6 Make all tests pass the crash test and fix a few more bugs 2016-12-27 21:40:04 -05:00
James Long 9acd34d67d update snapshots 2016-12-27 13:29:31 -05:00
Christopher Chedeau cf45afba61 Add testing
- This brings in the flow test suite that contains a ton of JavaScript parsing edge cases
- This creates snapshot tests using the pretty printer for all of them
- If uncomment `RUN_AST_TESTS` line in `tests/run_specs.js`, it checks ast(pretty_print(x)) == ast(x). Right now, "178 failed, 197 passed, 375 of 377 total". So half of the tests are not passing, most of them are crashes and many of the rest are subtle issues.
2016-12-23 19:51:53 +00:00