Commit Graph

24 Commits (7c9823fcbafd591c58331414bf9b7f44010344b1)

Author SHA1 Message Date
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
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
Lucas Duailibe 465729685f Fix indentation of intersection object types (#3074) 2017-10-21 17:45:41 +11: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 3d64e789b5 Improve printing of chained interesctions (#1155)
Now properly indents all the combinations of objects and non objects.

Fixes #1076
2017-04-10 10:50:38 -07:00
Christopher Chedeau dc0fbf7822 Special logic for flow intersection (#1018)
We started using the same logic for union and intersection but then added a special case for `a & {}`. It turns out that they should be handled completely differently in practice.

The heuristic i'm using is if you go from object to non-object or vis-versa, then inline, otherwise go to the next line and indent (like &&).

Fixes #864
Fixes #1017
2017-03-22 10:01:34 -07: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
James Long a7405257ac Print binary and logical expressions in a nicer format (#262)
* Print binary and logical expressions in a nicer format (fixes #89)

* Improve algorithm (wip)

* Change grouping

* Final (hopefully?) pass at binary/logical expressions

* Update snapshots

* Add tests
2017-01-18 17:01:17 -05:00
Christopher Chedeau f79e838095 Fix trailing whitespace (#300)
In the printer, remove trailing whitespace except for template literals

Fixes #222
2017-01-18 15:38:33 -05:00
Christopher Chedeau 789a3029f4 Remove +1 from newline detection (#261)
* Remove +1 from newline detection

All the changes are related to spurious `;`. Sometimes the logic is more correct, sometimes less. Since `;` are going to be removed after the first save, I don't think it matters that much.

* Handle inconsistent `end` node locations when looking for newlines
2017-01-17 22:33:55 -05:00
James Long 00fad62c91 Regenerate snapshots 2017-01-11 10:16:38 -05:00
Jeremy Morrell 9213d5ad7f First attempt at making union types prettier 2017-01-10 18:31:29 -03: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 5c39dc02e6 Improve intersection and union type annotation 2017-01-05 14:43:05 -05:00
James Long b550f1d088 Use , to separate type fields instead of ; 2017-01-04 17:26:44 -05:00
James Long 37601b0a86 Update snapshots 2017-01-01 20:20:45 -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 7ea2348b03 Various fixes with destructuring default, JSX, and more; all tests pass! 2016-12-30 17:00:11 -05:00
James Long 11a01552a4 Lots of bug fixes (will do smaller commits from now on) 2016-12-30 00:01:44 -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