Commit Graph

45 Commits (master)

Author SHA1 Message Date
Georgii Dolzhykov ea6ae31ba0
test: fix a FIXME, add typescript (#6744)
* test: fix a FIXME, add typescript

* tests/es6modules

* tests/no-semi

* tests/array_spread
2019-11-01 18:43:03 +02:00
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
Jordan Brown 5d47e02f64 Update flow parser to 0.84.0 (#5303) 2018-10-26 22:14:47 +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 Azzola 2a58e6bc06 test(typescript): enable typescript-verify on most tests (#1781) 2017-05-27 17:57:07 -07:00
Simon Lydell bc5186e544 Run Prettier on all source files (#1648)
This commit updates `npm run format:all` to not only format .js files in
src/ and bin/, but also tests_config/ and scripts/, as well as all
jsfmt.spec.js files.

It also includes the result of running `npm run format:all`, except
changes to src/ and bin/.
2017-05-21 08:13:11 -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
ChristianHersevoort 04c959d687 Feature/verify against same snapshot (#1087)
* Verify parsers against same snapshot

- Reworked run_spec, now accepts 3th optional array argument for
additional parsers to verify against
- Merged duplicate run_spec configs
- Removed duplicate snapshot data

* Formatted run_spec.js with prettier

* Fixed node4 incompatibility
2017-03-25 08:10:17 -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
Christopher Chedeau 569791a57a Update babylon to 7.0.0-beta.4 (#1047)
Fixes #700
2017-03-20 12:46:31 -04:00
Christopher Chedeau 3649835ce0 Keep parenthesis on export default function (#844)
It turns out that my fix was not correct. We should not add parenthesis for FunctionDeclaration instead of checking if the function expression is named.

Fixes #819
2017-03-02 22:39:22 -05:00
Christopher Chedeau 08b8a5f2e7 Do not put parenthesis around not named default export (#819)
We need to add parenthesis around function expressions if they are named otherwise the name leak, but if the function is not named then it's just superfluous.

The conditional change is due to a bad use of switch case where it would fall through the next one. We don't want parenthesis there.
2017-02-27 16:46:17 -05:00
Brian Ng 543e62cd31 Revert babylon bump (#792) 2017-02-23 09:00:57 -08:00
Brian Ng 211deb527e Bump babylon & add test for async func decl (#790)
* Add test for async function declaration

* Bump babylon version
2017-02-23 09:32:20 -05: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 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 e13bb7dbba [RFC] Do not put spacing inside of arrays with bracketSpacing option enabled (#446)
Given the discussion on #296, it seems like there's debate between spaces around `{}` but no one puts spaces around `[]`. So changing the behavior to respect this.
2017-01-24 11:38:12 -08:00
Christopher Chedeau fb52e7a5c8 Do not put a newline on empty `{}` for functions (#447)
The original intent of it was for `if then else` and `try catch` as they aren't likely to be empty, but it accidentally caught function bodys, which have many valid reasons to be empty. Let's special case those out.
2017-01-24 12:37:01 -05:00
Brian Ng b953ff0835 Add parens for default export FunctionExpressions (#345)
* Add parens for default export FunctionExpressions

* add exception for ArrowFunctionExpression

* add additional test cases

* thanks bakkot :)
2017-01-20 19:17:16 -08:00
Kevin Gibbons a8ca2b21f4 Add semicolon to more default exports (#343) 2017-01-19 14:30:36 -08:00
Brian Ng c02bd6a8d5 Handle additional export default parens cases (#298) 2017-01-18 11:11:52 -08:00
Brian Ng 083876e66d Fix missing semi when default exporting CallExpression (#287) 2017-01-18 09:03:31 -08: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
Christopher Chedeau 8e0f97e410 Break multiline imports (#167)
Follows the same pattern as https://github.com/jlongster/prettier/pull/156/files

```js
echo "import { aaaaaaaa, bbbbbb, cccccc, dddddddd, eeeeeee, fffffffff, ggggggggg } from 'vjeux';" | ./bin/prettier.js --stdin
import {
  aaaaaaaa,
  bbbbbb,
  cccccc,
  dddddddd,
  eeeeeee,
  fffffffff,
  ggggggggg
} from "vjeux";
```
2017-01-13 12:59:33 -05:00
James Long aab300844f Use group instead of conditionalGroup 2017-01-12 14:53:12 -05:00
Benjamin Tan 1549936e68 Break long `exports` into multiple lines.
Ref #19.
2017-01-12 14:38:22 -05:00
James Long 00fad62c91 Regenerate snapshots 2017-01-11 10:16:38 -05:00
Benjamin Tan d56365dd54 Add semicolons to `export` declarations.
Closes #22.
2017-01-11 20:43:27 +08:00
Dan Harper 7c21dd037f Fix import & export bracket spacing (fixes #24) 2017-01-11 00:32:57 +00:00
James Long d2d6def9be Revert "fixes #49: omit new parens when it has no arguments"
This reverts commit b5392f9468.
2017-01-10 18:53:03 -05:00
Michael Ficarra b5392f9468 fixes #49: omit new parens when it has no arguments 2017-01-10 11:14:39 -08: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 8326963f2d Add option to include spaces inside object/array literals, default to false 2017-01-04 17:23:07 -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 e972a7f0b6 Fix object and predicate annotations 2016-12-30 13:32:43 -05:00
James Long 6715abca76 Tweak variable declaration printing 2016-12-30 11:56:42 -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