Commit Graph

75 Commits (master)

Author SHA1 Message Date
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
Rasmus Eneman e41ed4955d [WIP] Add some typescript tests (#1033)
* Add some typescript tests

* fix: Remove extraneous colon in type parameter constraint

* style: Add missing newline at EOF in TS tests

* feat: Pretty print typescript object type annotations

* feat: Pretty print TSFunctionType

* fix: Type annotations was missing on class properties

* Add a new batch of tests

* Bump typescript-eslint-parser

* Add a new batch of tests and fix a syntax error in previous

* Bump typescript-eslint-parser
2017-03-19 08:06:52 -07:00
Christopher Chedeau d8d5c7bc55 Introduce --parser/parser option and deprecate --flow-parser/useFlowParser (#342)
The previous API was inconsistent. The new one is

```js
--parser flow
--parser babylon

{parser: 'flow'}
{parser: 'babylon'}
```

if we ever want to add new parsers in the future it'll allow that more easily.

I put a console.log in parser.js in both functions and tested that the test suite worked both with and without the change in run_spec. I also tested that both the previous and new command line options are working.

At some point in the future we'll likely want to get rid of the old api but might as well keep supporting it so we don't break anyone for now.
2017-01-19 14:35:12 -08:00
Christopher Chedeau aef3e387f8 Extract parser.js (#338)
Before, we would parse things inline in both index.js and run_spec. Extracting it should make it easier to manage and understand what is going on.
2017-01-19 13:23:04 -08:00
Christopher Chedeau 05be0eb31b Add flow parser experimental options (#221)
The Nuclide codebase uses features that are still proposals which require a flag to be enabled. Babylon parses them fine without any flags.

Let's enable them by default as it doesn't cost much, you either are using those features and you don't want the parser to break, or you are not and you don't care.

After this and #218, none of the nuclide files are throwing exceptions! (yay!)
2017-01-15 23:46:27 -05:00
Rogelio Guzman ec5b0f7c76 Fix for Node 4 2017-01-13 13:25:13 -05:00
Rogelio Guzman 3e0ac6c18e Update run_spec to support options 2017-01-13 13:25:13 -05:00
James Long 62bfdcd65a Fix old name reference in tests_config 2017-01-12 10:09:13 -05:00
Henry Zhu 80f280d6a3 remove unused recast ref 2017-01-11 15:38:58 -05:00
James Long 4abb8ce544 Support back to node v4 2017-01-10 12:18:22 -05:00
Benjamin Tan e72347e51b Fix tests on Windows.
Convert CRLF into LF for Jest’s snapshot matching.
2017-01-10 22:34:24 +08: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 0465bb5790 Add flow parser as an option, default to babylon 2016-12-30 21:23:50 -05:00
James Long 649e8a1efe Add DeclareExportAllDeclaration to ast-types 2016-12-30 15:07:35 -05:00
James Long a6f1e79db1 Ignore EmptyStatements when comparing asts, now down to 12 real failures \o/ 2016-12-30 14:44:57 -05:00
James Long ed57110ef5 Add type parameters on anon functions 2016-12-30 13:41:45 -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
James Long 599e5821c1 Optimize jest testing and implement more fixes 2016-12-27 13:28:04 -05:00
James Long 87f4a85edc Invoke JS API in tests instead of invoking executable every run 2016-12-23 21:12:18 -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