From b0fe6bdbc3c4803e15ee26bee43e7afd7a907ad9 Mon Sep 17 00:00:00 2001 From: Tony Gorez Date: Wed, 23 Jun 2021 17:11:06 +0200 Subject: [PATCH] chore(parser): add test to handle optional paramteter in async call (#13504) * chore(parser): add test to handle optional paramteter in async call * chore(parser): add flow test * chore(parser): add ts test --- .../es2017/async-call/with-optional-operator/input.js | 1 + .../es2017/async-call/with-optional-operator/options.json | 3 +++ .../flow/async-call/with-optional-parameter/input.js | 1 + .../flow/async-call/with-optional-parameter/options.json | 8 ++++++++ .../async-call/with-optional-parameter/input.ts | 1 + .../async-call/with-optional-parameter/options.json | 7 +++++++ 6 files changed, 21 insertions(+) create mode 100644 packages/babel-parser/test/fixtures/es2017/async-call/with-optional-operator/input.js create mode 100644 packages/babel-parser/test/fixtures/es2017/async-call/with-optional-operator/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/async-call/with-optional-parameter/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/async-call/with-optional-parameter/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/async-call/with-optional-parameter/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/async-call/with-optional-parameter/options.json diff --git a/packages/babel-parser/test/fixtures/es2017/async-call/with-optional-operator/input.js b/packages/babel-parser/test/fixtures/es2017/async-call/with-optional-operator/input.js new file mode 100644 index 0000000000..e07902953d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-call/with-optional-operator/input.js @@ -0,0 +1 @@ +async(x?) \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-call/with-optional-operator/options.json b/packages/babel-parser/test/fixtures/es2017/async-call/with-optional-operator/options.json new file mode 100644 index 0000000000..65ef4a184a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-call/with-optional-operator/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (1:8)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/async-call/with-optional-parameter/input.js b/packages/babel-parser/test/fixtures/flow/async-call/with-optional-parameter/input.js new file mode 100644 index 0000000000..e07902953d --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/async-call/with-optional-parameter/input.js @@ -0,0 +1 @@ +async(x?) \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/async-call/with-optional-parameter/options.json b/packages/babel-parser/test/fixtures/flow/async-call/with-optional-parameter/options.json new file mode 100644 index 0000000000..873363b4a4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/async-call/with-optional-parameter/options.json @@ -0,0 +1,8 @@ +{ + "sourceType": "module", + "plugins": [ + "jsx", + "flow" + ], + "throws": "Unexpected token (1:8)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/async-call/with-optional-parameter/input.ts b/packages/babel-parser/test/fixtures/typescript/async-call/with-optional-parameter/input.ts new file mode 100644 index 0000000000..e07902953d --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/async-call/with-optional-parameter/input.ts @@ -0,0 +1 @@ +async(x?) \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/async-call/with-optional-parameter/options.json b/packages/babel-parser/test/fixtures/typescript/async-call/with-optional-parameter/options.json new file mode 100644 index 0000000000..e141bfeb81 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/async-call/with-optional-parameter/options.json @@ -0,0 +1,7 @@ +{ + "sourceType": "module", + "plugins": [ + "typescript" + ], + "throws": "Unexpected token (1:8)" +} \ No newline at end of file