From 26ece61e7382607e06004b925b4bbeaae634b5a5 Mon Sep 17 00:00:00 2001 From: fisker Date: Mon, 14 Jun 2021 00:21:27 +0800 Subject: [PATCH] Test for https://github.com/babel/babel/pull/13410 --- .../__snapshots__/jsfmt.spec.js.snap | 18 ++++++++++++++++++ .../misc/errors/js/async-await/jsfmt.spec.js | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/format/misc/errors/js/async-await/__snapshots__/jsfmt.spec.js.snap b/tests/format/misc/errors/js/async-await/__snapshots__/jsfmt.spec.js.snap index ddcde031cc7b..ae58604afff3 100644 --- a/tests/format/misc/errors/js/async-await/__snapshots__/jsfmt.spec.js.snap +++ b/tests/format/misc/errors/js/async-await/__snapshots__/jsfmt.spec.js.snap @@ -84,6 +84,12 @@ exports[`snippet: #1 [babel] format 2`] = ` | ^" `; +exports[`snippet: #1 [babel] format 3`] = ` +"Unexpected token (1:15) +> 1 | async({ foo33 = 1 }); + | ^" +`; + exports[`snippet: #1 [espree] format 1`] = ` "Cannot use keyword 'await' outside an async function (1:12) > 1 | async (x = await 2) => {}; @@ -91,6 +97,12 @@ exports[`snippet: #1 [espree] format 1`] = ` `; exports[`snippet: #1 [espree] format 2`] = ` +"Shorthand property assignments are valid only in destructuring patterns (1:15) +> 1 | async({ foo33 = 1 }); + | ^" +`; + +exports[`snippet: #1 [espree] format 3`] = ` "Cannot use keyword 'await' outside an async function (1:1) > 1 | await 0; | ^" @@ -109,6 +121,12 @@ exports[`snippet: #1 [meriyah] format 1`] = ` `; exports[`snippet: #1 [meriyah] format 2`] = ` +"[1:21]: Invalid shorthand property initializer (1:21) +> 1 | async({ foo33 = 1 }); + | ^" +`; + +exports[`snippet: #1 [meriyah] format 3`] = ` "[1:5]: 'Await' may not be used as an identifier in this context (1:5) > 1 | await 0; | ^" diff --git a/tests/format/misc/errors/js/async-await/jsfmt.spec.js b/tests/format/misc/errors/js/async-await/jsfmt.spec.js index 752a145aceaf..ed8d92816e9b 100644 --- a/tests/format/misc/errors/js/async-await/jsfmt.spec.js +++ b/tests/format/misc/errors/js/async-await/jsfmt.spec.js @@ -42,7 +42,7 @@ run_spec( run_spec( { dirname: __dirname, - snippets: ["async (x = await (2)) => {};"], + snippets: ["async (x = await (2)) => {};", "async({ foo33 = 1 });"], }, ["babel", "espree", "meriyah"] );