From 643d33001fd1857bd187bb9d3652ed6358069ce1 Mon Sep 17 00:00:00 2001 From: liuxingbaoyu <30521560+liuxingbaoyu@users.noreply.github.com> Date: Tue, 26 Jul 2022 01:56:59 +0800 Subject: [PATCH] Revert "Disable a test (#13159)" This reverts commit 26cf77a5d5d621d183a92245108720929076f8fc. --- tests/config/format-test.js | 2 - .../strings/__snapshots__/jsfmt.spec.js.snap | 44 +++++++++++++++++++ tests/format/js/strings/jsfmt.spec.js | 15 ++++++- 3 files changed, 57 insertions(+), 4 deletions(-) diff --git a/tests/config/format-test.js b/tests/config/format-test.js index 366d4c498467..98151797d787 100644 --- a/tests/config/format-test.js +++ b/tests/config/format-test.js @@ -52,8 +52,6 @@ const espreeDisabledTests = new Set( [ // These tests only work for `babel` "comments-closure-typecast", - // Unknown reason https://github.com/babel/babel/pull/14779#discussion_r928137651 - "strings", ].map((directory) => path.join(__dirname, "../format/js", directory)) ); const acornDisabledTests = espreeDisabledTests; diff --git a/tests/format/js/strings/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/strings/__snapshots__/jsfmt.spec.js.snap index 4da5b3c205df..dc97633deb10 100644 --- a/tests/format/js/strings/__snapshots__/jsfmt.spec.js.snap +++ b/tests/format/js/strings/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,49 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`non-octal-eight-and-nine.js [acorn] format 1`] = ` +"Invalid escape sequence (3:3) + 1 | // https://github.com/babel/babel/pull/11852 + 2 | +> 3 | "\\8","\\9"; + | ^ + 4 | () => { + 5 | "use strict"; + 6 | "\\8", "\\9";" +`; + +exports[`non-octal-eight-and-nine.js [espree] format 1`] = ` +"Invalid escape sequence (3:3) + 1 | // https://github.com/babel/babel/pull/11852 + 2 | +> 3 | "\\8","\\9"; + | ^ + 4 | () => { + 5 | "use strict"; + 6 | "\\8", "\\9";" +`; + +exports[`non-octal-eight-and-nine.js - {"trailingComma":"all"} [acorn] format 1`] = ` +"Invalid escape sequence (3:3) + 1 | // https://github.com/babel/babel/pull/11852 + 2 | +> 3 | "\\8","\\9"; + | ^ + 4 | () => { + 5 | "use strict"; + 6 | "\\8", "\\9";" +`; + +exports[`non-octal-eight-and-nine.js - {"trailingComma":"all"} [espree] format 1`] = ` +"Invalid escape sequence (3:3) + 1 | // https://github.com/babel/babel/pull/11852 + 2 | +> 3 | "\\8","\\9"; + | ^ + 4 | () => { + 5 | "use strict"; + 6 | "\\8", "\\9";" +`; + exports[`non-octal-eight-and-nine.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["babel", "flow"] diff --git a/tests/format/js/strings/jsfmt.spec.js b/tests/format/js/strings/jsfmt.spec.js index 23e9edc554f5..c1f60b1648bb 100644 --- a/tests/format/js/strings/jsfmt.spec.js +++ b/tests/format/js/strings/jsfmt.spec.js @@ -1,2 +1,13 @@ -run_spec(import.meta, ["babel", "flow"]); -run_spec(import.meta, ["babel", "flow"], { trailingComma: "all" }); +run_spec(import.meta, ["babel", "flow"], { + errors: { + acorn: ["non-octal-eight-and-nine.js"], + espree: ["non-octal-eight-and-nine.js"], + }, +}); +run_spec(import.meta, ["babel", "flow"], { + trailingComma: "all", + errors: { + acorn: ["non-octal-eight-and-nine.js"], + espree: ["non-octal-eight-and-nine.js"], + }, +});