From 7417d90a16b549fe9eeb0409efbee1229ba0a7a1 Mon Sep 17 00:00:00 2001 From: sosukesuzuki Date: Fri, 16 Oct 2020 00:08:25 +0900 Subject: [PATCH] Add test for babel/babel#12120 --- tests/js/objects/jsfmt.spec.js | 2 +- .../__snapshots__/jsfmt.spec.js.snap | 14 ++++++++++++++ tests/js/variable_declarator/invalid-const.js | 1 + tests/js/variable_declarator/jsfmt.spec.js | 7 ++++++- 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 tests/js/variable_declarator/invalid-const.js diff --git a/tests/js/objects/jsfmt.spec.js b/tests/js/objects/jsfmt.spec.js index 5ac39ca0386f..74867c290696 100644 --- a/tests/js/objects/jsfmt.spec.js +++ b/tests/js/objects/jsfmt.spec.js @@ -4,6 +4,6 @@ run_spec(__dirname, ["babel"], { "expression.js", "invalid-accessor-generator.js", "invalid-setter.js", - ] + ], }, }); diff --git a/tests/js/variable_declarator/__snapshots__/jsfmt.spec.js.snap b/tests/js/variable_declarator/__snapshots__/jsfmt.spec.js.snap index 8176ccad8608..a89b178417dc 100644 --- a/tests/js/variable_declarator/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/variable_declarator/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,19 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`invalid-const.js format 1`] = ` +====================================options===================================== +parsers: ["babel", "flow", "typescript"] +printWidth: 80 + | printWidth +=====================================input====================================== +const foo; + +=====================================output===================================== +const foo; + +================================================================================ +`; + exports[`multiple.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] diff --git a/tests/js/variable_declarator/invalid-const.js b/tests/js/variable_declarator/invalid-const.js new file mode 100644 index 000000000000..f15614ea39c3 --- /dev/null +++ b/tests/js/variable_declarator/invalid-const.js @@ -0,0 +1 @@ +const foo; diff --git a/tests/js/variable_declarator/jsfmt.spec.js b/tests/js/variable_declarator/jsfmt.spec.js index eb85eda6bd02..7ad187763274 100644 --- a/tests/js/variable_declarator/jsfmt.spec.js +++ b/tests/js/variable_declarator/jsfmt.spec.js @@ -1 +1,6 @@ -run_spec(__dirname, ["babel", "flow", "typescript"]); +run_spec(__dirname, ["babel", "flow", "typescript"], { + errors: { + espree: ["invalid-const.js"], + flow: ["invalid-const.js"], + }, +});