From 5b66255085ef4bb8b11f27d0d3b3461f885bf756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 24 Sep 2019 17:30:28 +0200 Subject: [PATCH] Update existing tests --- .../basic/array-expression-trailing-comma/output.json | 10 ++++++++-- .../function-trailing-comma-shorthand/output.json | 3 +++ .../comments/basic/function-trailing-comma/output.json | 3 +++ .../basic/object-expression-trailing-comma/output.json | 3 +++ .../basic/object-property-trailing-comma/output.json | 5 ++++- .../fixtures/comments/regression/10230/output.json | 5 ++++- .../test/fixtures/core/uncategorised/10/output.json | 5 ++++- .../test/fixtures/core/uncategorised/12/output.json | 5 ++++- .../test/fixtures/core/uncategorised/13/output.json | 5 ++++- .../array-rest-spread/comma-after-spread/output.json | 5 ++++- .../test/fixtures/es2015/uncategorised/322/output.json | 5 ++++- .../params-invalid-rest-trailing-comma/options.json | 4 ++-- .../es2017/trailing-function-commas/1/output.json | 5 ++++- .../fixtures/es2018/object-rest-spread/10/output.json | 5 ++++- .../fixtures/es2018/object-rest-spread/6/output.json | 1 + .../object-rest-spread/comma-after-spread/output.json | 1 + .../es2015-array-binding-pattern/elision/output.json | 5 ++++- .../elision/output.json | 5 ++++- .../proto-identifier-method/output.json | 1 + .../proto-literal-method/output.json | 1 + .../esprima/es2015-object-pattern/elision/output.json | 5 ++++- .../expression-primary-array/migrated_0003/output.json | 5 ++++- .../expression-primary-array/migrated_0005/output.json | 5 ++++- .../expression-primary-array/migrated_0006/output.json | 5 ++++- .../test/fixtures/flow/tuples/3/output.json | 5 ++++- .../object-method-type-param-jsx/output.json | 7 +++++-- .../object-reserved-word/output.json | 5 ++++- 27 files changed, 96 insertions(+), 23 deletions(-) diff --git a/packages/babel-parser/test/fixtures/comments/basic/array-expression-trailing-comma/output.json b/packages/babel-parser/test/fixtures/comments/basic/array-expression-trailing-comma/output.json index 90428301c81b..a1a531180079 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/array-expression-trailing-comma/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/array-expression-trailing-comma/output.json @@ -373,7 +373,10 @@ } ] } - ] + ], + "extra": { + "trailingComma": 140 + } } } ], @@ -494,7 +497,10 @@ } ] } - ] + ], + "extra": { + "trailingComma": 200 + } } } ], diff --git a/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma-shorthand/output.json b/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma-shorthand/output.json index 3e22bc1678e5..451ca5ee6450 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma-shorthand/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma-shorthand/output.json @@ -183,6 +183,9 @@ ] } ], + "extra": { + "trailingComma": 28 + }, "trailingComments": [ { "type": "CommentBlock", diff --git a/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma/output.json b/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma/output.json index 6147660b79f9..5d97d11703f9 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma/output.json @@ -128,6 +128,9 @@ ] } ], + "extra": { + "trailingComma": 24 + }, "trailingComments": [ { "type": "CommentBlock", diff --git a/packages/babel-parser/test/fixtures/comments/basic/object-expression-trailing-comma/output.json b/packages/babel-parser/test/fixtures/comments/basic/object-expression-trailing-comma/output.json index 5f2a5b29b779..8cf9693cb683 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/object-expression-trailing-comma/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/object-expression-trailing-comma/output.json @@ -181,6 +181,9 @@ } } ], + "extra": { + "trailingComma": 35 + }, "trailingComments": [ { "type": "CommentBlock", diff --git a/packages/babel-parser/test/fixtures/comments/basic/object-property-trailing-comma/output.json b/packages/babel-parser/test/fixtures/comments/basic/object-property-trailing-comma/output.json index 82f13bbfed5e..1ab0eaed8cb3 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/object-property-trailing-comma/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/object-property-trailing-comma/output.json @@ -309,7 +309,10 @@ } ] } - ] + ], + "extra": { + "trailingComma": 66 + } } } ], diff --git a/packages/babel-parser/test/fixtures/comments/regression/10230/output.json b/packages/babel-parser/test/fixtures/comments/regression/10230/output.json index f081d1ee65fd..fac57ee10213 100644 --- a/packages/babel-parser/test/fixtures/comments/regression/10230/output.json +++ b/packages/babel-parser/test/fixtures/comments/regression/10230/output.json @@ -163,7 +163,10 @@ } ] } - ] + ], + "extra": { + "trailingComma": 13 + } } }, "trailingComments": [ diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/10/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/10/output.json index 3f7e070ca3ac..d2f456d828ab 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/10/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/10/output.json @@ -110,7 +110,10 @@ }, "value": 42 } - ] + ], + "extra": { + "trailingComma": 8 + } } } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/12/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/12/output.json index 573eda5bfa9f..0c39b167df03 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/12/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/12/output.json @@ -150,7 +150,10 @@ }, "value": 3 } - ] + ], + "extra": { + "trailingComma": 13 + } } } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/13/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/13/output.json index 34c8d7e15c8e..c2fec5bfcf25 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/13/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/13/output.json @@ -151,7 +151,10 @@ }, "value": 3 } - ] + ], + "extra": { + "trailingComma": 14 + } } } } diff --git a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread/output.json b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread/output.json index 5874666e2695..0a80d6e9f99b 100644 --- a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread/output.json +++ b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread/output.json @@ -90,7 +90,10 @@ "name": "a" } } - ] + ], + "extra": { + "trailingComma": 5 + } } } ], diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/322/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/322/output.json index 1749b8360656..68286e968b5c 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/322/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/322/output.json @@ -91,7 +91,10 @@ "name": "x" }, null - ] + ], + "extra": { + "trailingComma": 3 + } }, "right": { "type": "NumericLiteral", diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/params-invalid-rest-trailing-comma/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/params-invalid-rest-trailing-comma/options.json index f686fb60b45e..4db995d1bd5d 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/params-invalid-rest-trailing-comma/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/params-invalid-rest-trailing-comma/options.json @@ -1,3 +1,3 @@ { - "throws": "Rest element must be last element (1:11)" -} + "throws": "Rest element must be last element (1:12)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/trailing-function-commas/1/output.json b/packages/babel-parser/test/fixtures/es2017/trailing-function-commas/1/output.json index 2373fc85c177..757662985881 100644 --- a/packages/babel-parser/test/fixtures/es2017/trailing-function-commas/1/output.json +++ b/packages/babel-parser/test/fixtures/es2017/trailing-function-commas/1/output.json @@ -132,7 +132,10 @@ }, "value": 2 } - ] + ], + "extra": { + "trailingComma": 14 + } } } ], diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/10/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/10/output.json index 485e729af53e..6b852f78deea 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/10/output.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/10/output.json @@ -183,7 +183,10 @@ "shorthand": true } } - ] + ], + "extra": { + "trailingComma": 10 + } }, "init": { "type": "Identifier", diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/6/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/6/output.json index 1e1e8979748a..66bdc45dc975 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/6/output.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/6/output.json @@ -289,6 +289,7 @@ } ], "extra": { + "trailingComma": 21, "parenthesized": true, "parenStart": 0 } diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread/output.json index ffb978345c27..2b3910bf3a5b 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread/output.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread/output.json @@ -92,6 +92,7 @@ } ], "extra": { + "trailingComma": 6, "parenthesized": true, "parenStart": 0 } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/elision/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/elision/output.json index 10c96101b155..2f49a3a77d71 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/elision/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/elision/output.json @@ -78,7 +78,10 @@ "elements": [ null, null - ] + ], + "extra": { + "trailingComma": 3 + } } ], "body": { diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/elision/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/elision/output.json index eebd569aa2e6..6032e42c2b32 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/elision/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/elision/output.json @@ -75,7 +75,10 @@ "elements": [ null, null - ] + ], + "extra": { + "trailingComma": 2 + } }, "right": { "type": "NumericLiteral", diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-method/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-method/output.json index d6a917129034..76754ed85da4 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-method/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-method/output.json @@ -166,6 +166,7 @@ } ], "extra": { + "trailingComma": 33, "parenthesized": true, "parenStart": 0 } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-method/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-method/output.json index 0995b435bf70..cd0e7970cac6 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-method/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-method/output.json @@ -169,6 +169,7 @@ } ], "extra": { + "trailingComma": 35, "parenthesized": true, "parenStart": 0 } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/elision/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/elision/output.json index 4f6c7b8f2be5..243668c0d0ad 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/elision/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/elision/output.json @@ -128,7 +128,10 @@ "shorthand": true } } - ] + ], + "extra": { + "trailingComma": 6 + } }, "init": { "type": "NumericLiteral", diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0003/output.json index 3f7e070ca3ac..d2f456d828ab 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0003/output.json @@ -110,7 +110,10 @@ }, "value": 42 } - ] + ], + "extra": { + "trailingComma": 8 + } } } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0005/output.json index 573eda5bfa9f..0c39b167df03 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0005/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0005/output.json @@ -150,7 +150,10 @@ }, "value": 3 } - ] + ], + "extra": { + "trailingComma": 13 + } } } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0006/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0006/output.json index 34c8d7e15c8e..c2fec5bfcf25 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0006/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0006/output.json @@ -151,7 +151,10 @@ }, "value": 3 } - ] + ], + "extra": { + "trailingComma": 14 + } } } } diff --git a/packages/babel-parser/test/fixtures/flow/tuples/3/output.json b/packages/babel-parser/test/fixtures/flow/tuples/3/output.json index 2c61f6b164a0..dada487fe124 100644 --- a/packages/babel-parser/test/fixtures/flow/tuples/3/output.json +++ b/packages/babel-parser/test/fixtures/flow/tuples/3/output.json @@ -157,7 +157,10 @@ }, "value": 123 } - ] + ], + "extra": { + "trailingComma": 24 + } } } ], diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/object-method-type-param-jsx/output.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/object-method-type-param-jsx/output.json index 9cbc275b184b..5e5de02ff3c2 100644 --- a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/object-method-type-param-jsx/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/object-method-type-param-jsx/output.json @@ -187,7 +187,6 @@ "column": 23 } }, - "attributes": [], "name": { "type": "JSXIdentifier", "start": 29, @@ -204,6 +203,7 @@ }, "name": "Foo" }, + "attributes": [], "selfClosing": true }, "closingElement": null, @@ -263,7 +263,10 @@ ] } } - ] + ], + "extra": { + "trailingComma": 39 + } } } ], diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/object-reserved-word/output.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/object-reserved-word/output.json index 5a8cfcc689b0..bd86fd173803 100644 --- a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/object-reserved-word/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/object-reserved-word/output.json @@ -450,7 +450,10 @@ ] } } - ] + ], + "extra": { + "trailingComma": 77 + } } } ],