From bac69974fd45b62897d9dcb364674de0bd19cc59 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Thu, 17 Nov 2022 22:45:35 +0800 Subject: [PATCH] Revert "Fix tests" This reverts commit 4f6a846d9441b461f7308dea6de71d13ac19fdc1. Accidentally pushed to `next` when working on #13853 --- .../class/__snapshots__/jsfmt.spec.js.snap | 19 +++++++++++++++++++ tests/format/typescript/class/jsfmt.spec.js | 2 +- tests/format/typescript/class/methods.ts | 4 ++++ .../compiler/__snapshots__/jsfmt.spec.js.snap | 17 +++++++++++++++++ .../modifiersOnInterfaceIndexSignature1.ts | 3 +++ 5 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 tests/format/typescript/compiler/modifiersOnInterfaceIndexSignature1.ts diff --git a/tests/format/typescript/class/__snapshots__/jsfmt.spec.js.snap b/tests/format/typescript/class/__snapshots__/jsfmt.spec.js.snap index d46cd242c..8725332e6 100644 --- a/tests/format/typescript/class/__snapshots__/jsfmt.spec.js.snap +++ b/tests/format/typescript/class/__snapshots__/jsfmt.spec.js.snap @@ -392,6 +392,17 @@ interface AudioBufferList { ================================================================================ `; +exports[`methods.ts [babel-ts] format 1`] = ` +"Unexpected token, expected ";" (6:10) + 4 | + 5 | interface Iterable { +> 6 | export [Symbol.iterator](): Iterator; + | ^ + 7 | } + 8 | + 9 | export class Check {" +`; + exports[`methods.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] @@ -402,6 +413,10 @@ class X { optionalMethod?() {} } +interface Iterable { + export [Symbol.iterator](): Iterator; +} + export class Check { private static property = 'test'; } @@ -411,6 +426,10 @@ class X { optionalMethod?() {} } +interface Iterable { + export [Symbol.iterator](): Iterator; +} + export class Check { private static property = "test"; } diff --git a/tests/format/typescript/class/jsfmt.spec.js b/tests/format/typescript/class/jsfmt.spec.js index dcdffcf46..72bcd1445 100644 --- a/tests/format/typescript/class/jsfmt.spec.js +++ b/tests/format/typescript/class/jsfmt.spec.js @@ -1,3 +1,3 @@ run_spec(import.meta, ["typescript"], { - errors: { "babel-ts": ["constructor.ts", "generics.ts"] }, + errors: { "babel-ts": ["constructor.ts", "generics.ts", "methods.ts"] }, }); diff --git a/tests/format/typescript/class/methods.ts b/tests/format/typescript/class/methods.ts index 60914eb08..799573c9c 100644 --- a/tests/format/typescript/class/methods.ts +++ b/tests/format/typescript/class/methods.ts @@ -2,6 +2,10 @@ class X { optionalMethod?() {} } +interface Iterable { + export [Symbol.iterator](): Iterator; +} + export class Check { private static property = 'test'; } diff --git a/tests/format/typescript/compiler/__snapshots__/jsfmt.spec.js.snap b/tests/format/typescript/compiler/__snapshots__/jsfmt.spec.js.snap index 4729c93c6..93d1d0e4d 100644 --- a/tests/format/typescript/compiler/__snapshots__/jsfmt.spec.js.snap +++ b/tests/format/typescript/compiler/__snapshots__/jsfmt.spec.js.snap @@ -661,6 +661,23 @@ const shouldFail: { important: boolean } = output.x.children; ================================================================================ `; +exports[`modifiersOnInterfaceIndexSignature1.ts format 1`] = ` +====================================options===================================== +parsers: ["typescript"] +printWidth: 80 + | printWidth +=====================================input====================================== +interface I { + public [a: string]: number; +} +=====================================output===================================== +interface I { + public [a: string]: number; +} + +================================================================================ +`; + exports[`privacyGloImport.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] diff --git a/tests/format/typescript/compiler/modifiersOnInterfaceIndexSignature1.ts b/tests/format/typescript/compiler/modifiersOnInterfaceIndexSignature1.ts new file mode 100644 index 000000000..212f82bca --- /dev/null +++ b/tests/format/typescript/compiler/modifiersOnInterfaceIndexSignature1.ts @@ -0,0 +1,3 @@ +interface I { + public [a: string]: number; +} \ No newline at end of file