From e82cf92fb46459c207fa6c19cc02b710392e8f35 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Thu, 29 Jan 2026 11:57:22 +0800 Subject: [PATCH] Add test for #6858 (#18780) --- .../10732.ts | 0 .../18041.ts | 0 .../18604.ts | 0 .../__snapshots__/format.test.js.snap | 46 +++++++++++++++++++ .../class-method.ts | 0 .../__snapshots__/format.test.js.snap | 0 .../consistent/flow-only.ts | 0 .../consistent/format.test.js | 0 .../consistent/issue-9501.ts | 0 .../consistent/simple-types.ts | 0 .../consistent/template-literal-types.ts | 0 .../consistent/typescript-only.ts | 0 .../const.ts | 0 .../constraints-and-default-2.ts | 0 .../constraints-and-default.ts | 0 .../format.test.js | 0 .../type-parameters-arguments/issue-6858.ts | 17 +++++++ .../long-function-arg.ts | 0 .../__snapshots__/format.test.js.snap | 0 .../print-width-120/format.test.js | 0 .../print-width-120/issue-7542.tsx | 0 .../tagged-template-expression.ts | 0 .../__snapshots__/format.test.js.snap | 0 .../trailing-comma/format.test.js | 0 .../trailing-comma/type-paramters.ts | 0 25 files changed, 63 insertions(+) rename tests/format/typescript/{type-params => type-parameters-arguments}/10732.ts (100%) rename tests/format/typescript/{type-params => type-parameters-arguments}/18041.ts (100%) rename tests/format/typescript/{type-params => type-parameters-arguments}/18604.ts (100%) rename tests/format/typescript/{type-params => type-parameters-arguments}/__snapshots__/format.test.js.snap (96%) rename tests/format/typescript/{type-params => type-parameters-arguments}/class-method.ts (100%) rename tests/format/typescript/{type-params => type-parameters-arguments}/consistent/__snapshots__/format.test.js.snap (100%) rename tests/format/typescript/{type-params => type-parameters-arguments}/consistent/flow-only.ts (100%) rename tests/format/typescript/{type-params => type-parameters-arguments}/consistent/format.test.js (100%) rename tests/format/typescript/{type-params => type-parameters-arguments}/consistent/issue-9501.ts (100%) rename tests/format/typescript/{type-params => type-parameters-arguments}/consistent/simple-types.ts (100%) rename tests/format/typescript/{type-params => type-parameters-arguments}/consistent/template-literal-types.ts (100%) rename tests/format/typescript/{type-params => type-parameters-arguments}/consistent/typescript-only.ts (100%) rename tests/format/typescript/{type-params => type-parameters-arguments}/const.ts (100%) rename tests/format/typescript/{type-params => type-parameters-arguments}/constraints-and-default-2.ts (100%) rename tests/format/typescript/{type-params => type-parameters-arguments}/constraints-and-default.ts (100%) rename tests/format/typescript/{type-params => type-parameters-arguments}/format.test.js (100%) create mode 100644 tests/format/typescript/type-parameters-arguments/issue-6858.ts rename tests/format/typescript/{type-params => type-parameters-arguments}/long-function-arg.ts (100%) rename tests/format/typescript/{type-params => type-parameters-arguments}/print-width-120/__snapshots__/format.test.js.snap (100%) rename tests/format/typescript/{type-params => type-parameters-arguments}/print-width-120/format.test.js (100%) rename tests/format/typescript/{type-params => type-parameters-arguments}/print-width-120/issue-7542.tsx (100%) rename tests/format/typescript/{type-params => type-parameters-arguments}/tagged-template-expression.ts (100%) rename tests/format/typescript/{type-params => type-parameters-arguments}/trailing-comma/__snapshots__/format.test.js.snap (100%) rename tests/format/typescript/{type-params => type-parameters-arguments}/trailing-comma/format.test.js (100%) rename tests/format/typescript/{type-params => type-parameters-arguments}/trailing-comma/type-paramters.ts (100%) diff --git a/tests/format/typescript/type-params/10732.ts b/tests/format/typescript/type-parameters-arguments/10732.ts similarity index 100% rename from tests/format/typescript/type-params/10732.ts rename to tests/format/typescript/type-parameters-arguments/10732.ts diff --git a/tests/format/typescript/type-params/18041.ts b/tests/format/typescript/type-parameters-arguments/18041.ts similarity index 100% rename from tests/format/typescript/type-params/18041.ts rename to tests/format/typescript/type-parameters-arguments/18041.ts diff --git a/tests/format/typescript/type-params/18604.ts b/tests/format/typescript/type-parameters-arguments/18604.ts similarity index 100% rename from tests/format/typescript/type-params/18604.ts rename to tests/format/typescript/type-parameters-arguments/18604.ts diff --git a/tests/format/typescript/type-params/__snapshots__/format.test.js.snap b/tests/format/typescript/type-parameters-arguments/__snapshots__/format.test.js.snap similarity index 96% rename from tests/format/typescript/type-params/__snapshots__/format.test.js.snap rename to tests/format/typescript/type-parameters-arguments/__snapshots__/format.test.js.snap index 465f61cb8..069e410b5 100644 --- a/tests/format/typescript/type-params/__snapshots__/format.test.js.snap +++ b/tests/format/typescript/type-parameters-arguments/__snapshots__/format.test.js.snap @@ -712,6 +712,52 @@ function makeChainWalker2< ================================================================================ `; +exports[`issue-6858.ts format 1`] = ` +====================================options===================================== +parsers: ["typescript"] +printWidth: 80 + | printWidth +=====================================input====================================== +testFunc< +//#region +{ + testProp: number +} +//#endregion +>(parserFunc\` +Some multiline string +In here\`); + +testFunc( +//#region +{ + testProp: number +} +//#endregion +) + +=====================================output===================================== +testFunc< + //#region + { + testProp: number; + } + //#endregion +>(parserFunc\` +Some multiline string +In here\`); + +testFunc( + //#region + { + testProp: number, + }, + //#endregion +); + +================================================================================ +`; + exports[`long-function-arg.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] diff --git a/tests/format/typescript/type-params/class-method.ts b/tests/format/typescript/type-parameters-arguments/class-method.ts similarity index 100% rename from tests/format/typescript/type-params/class-method.ts rename to tests/format/typescript/type-parameters-arguments/class-method.ts diff --git a/tests/format/typescript/type-params/consistent/__snapshots__/format.test.js.snap b/tests/format/typescript/type-parameters-arguments/consistent/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/typescript/type-params/consistent/__snapshots__/format.test.js.snap rename to tests/format/typescript/type-parameters-arguments/consistent/__snapshots__/format.test.js.snap diff --git a/tests/format/typescript/type-params/consistent/flow-only.ts b/tests/format/typescript/type-parameters-arguments/consistent/flow-only.ts similarity index 100% rename from tests/format/typescript/type-params/consistent/flow-only.ts rename to tests/format/typescript/type-parameters-arguments/consistent/flow-only.ts diff --git a/tests/format/typescript/type-params/consistent/format.test.js b/tests/format/typescript/type-parameters-arguments/consistent/format.test.js similarity index 100% rename from tests/format/typescript/type-params/consistent/format.test.js rename to tests/format/typescript/type-parameters-arguments/consistent/format.test.js diff --git a/tests/format/typescript/type-params/consistent/issue-9501.ts b/tests/format/typescript/type-parameters-arguments/consistent/issue-9501.ts similarity index 100% rename from tests/format/typescript/type-params/consistent/issue-9501.ts rename to tests/format/typescript/type-parameters-arguments/consistent/issue-9501.ts diff --git a/tests/format/typescript/type-params/consistent/simple-types.ts b/tests/format/typescript/type-parameters-arguments/consistent/simple-types.ts similarity index 100% rename from tests/format/typescript/type-params/consistent/simple-types.ts rename to tests/format/typescript/type-parameters-arguments/consistent/simple-types.ts diff --git a/tests/format/typescript/type-params/consistent/template-literal-types.ts b/tests/format/typescript/type-parameters-arguments/consistent/template-literal-types.ts similarity index 100% rename from tests/format/typescript/type-params/consistent/template-literal-types.ts rename to tests/format/typescript/type-parameters-arguments/consistent/template-literal-types.ts diff --git a/tests/format/typescript/type-params/consistent/typescript-only.ts b/tests/format/typescript/type-parameters-arguments/consistent/typescript-only.ts similarity index 100% rename from tests/format/typescript/type-params/consistent/typescript-only.ts rename to tests/format/typescript/type-parameters-arguments/consistent/typescript-only.ts diff --git a/tests/format/typescript/type-params/const.ts b/tests/format/typescript/type-parameters-arguments/const.ts similarity index 100% rename from tests/format/typescript/type-params/const.ts rename to tests/format/typescript/type-parameters-arguments/const.ts diff --git a/tests/format/typescript/type-params/constraints-and-default-2.ts b/tests/format/typescript/type-parameters-arguments/constraints-and-default-2.ts similarity index 100% rename from tests/format/typescript/type-params/constraints-and-default-2.ts rename to tests/format/typescript/type-parameters-arguments/constraints-and-default-2.ts diff --git a/tests/format/typescript/type-params/constraints-and-default.ts b/tests/format/typescript/type-parameters-arguments/constraints-and-default.ts similarity index 100% rename from tests/format/typescript/type-params/constraints-and-default.ts rename to tests/format/typescript/type-parameters-arguments/constraints-and-default.ts diff --git a/tests/format/typescript/type-params/format.test.js b/tests/format/typescript/type-parameters-arguments/format.test.js similarity index 100% rename from tests/format/typescript/type-params/format.test.js rename to tests/format/typescript/type-parameters-arguments/format.test.js diff --git a/tests/format/typescript/type-parameters-arguments/issue-6858.ts b/tests/format/typescript/type-parameters-arguments/issue-6858.ts new file mode 100644 index 000000000..c5c536954 --- /dev/null +++ b/tests/format/typescript/type-parameters-arguments/issue-6858.ts @@ -0,0 +1,17 @@ +testFunc< +//#region +{ + testProp: number +} +//#endregion +>(parserFunc` +Some multiline string +In here`); + +testFunc( +//#region +{ + testProp: number +} +//#endregion +) diff --git a/tests/format/typescript/type-params/long-function-arg.ts b/tests/format/typescript/type-parameters-arguments/long-function-arg.ts similarity index 100% rename from tests/format/typescript/type-params/long-function-arg.ts rename to tests/format/typescript/type-parameters-arguments/long-function-arg.ts diff --git a/tests/format/typescript/type-params/print-width-120/__snapshots__/format.test.js.snap b/tests/format/typescript/type-parameters-arguments/print-width-120/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/typescript/type-params/print-width-120/__snapshots__/format.test.js.snap rename to tests/format/typescript/type-parameters-arguments/print-width-120/__snapshots__/format.test.js.snap diff --git a/tests/format/typescript/type-params/print-width-120/format.test.js b/tests/format/typescript/type-parameters-arguments/print-width-120/format.test.js similarity index 100% rename from tests/format/typescript/type-params/print-width-120/format.test.js rename to tests/format/typescript/type-parameters-arguments/print-width-120/format.test.js diff --git a/tests/format/typescript/type-params/print-width-120/issue-7542.tsx b/tests/format/typescript/type-parameters-arguments/print-width-120/issue-7542.tsx similarity index 100% rename from tests/format/typescript/type-params/print-width-120/issue-7542.tsx rename to tests/format/typescript/type-parameters-arguments/print-width-120/issue-7542.tsx diff --git a/tests/format/typescript/type-params/tagged-template-expression.ts b/tests/format/typescript/type-parameters-arguments/tagged-template-expression.ts similarity index 100% rename from tests/format/typescript/type-params/tagged-template-expression.ts rename to tests/format/typescript/type-parameters-arguments/tagged-template-expression.ts diff --git a/tests/format/typescript/type-params/trailing-comma/__snapshots__/format.test.js.snap b/tests/format/typescript/type-parameters-arguments/trailing-comma/__snapshots__/format.test.js.snap similarity index 100% rename from tests/format/typescript/type-params/trailing-comma/__snapshots__/format.test.js.snap rename to tests/format/typescript/type-parameters-arguments/trailing-comma/__snapshots__/format.test.js.snap diff --git a/tests/format/typescript/type-params/trailing-comma/format.test.js b/tests/format/typescript/type-parameters-arguments/trailing-comma/format.test.js similarity index 100% rename from tests/format/typescript/type-params/trailing-comma/format.test.js rename to tests/format/typescript/type-parameters-arguments/trailing-comma/format.test.js diff --git a/tests/format/typescript/type-params/trailing-comma/type-paramters.ts b/tests/format/typescript/type-parameters-arguments/trailing-comma/type-paramters.ts similarity index 100% rename from tests/format/typescript/type-params/trailing-comma/type-paramters.ts rename to tests/format/typescript/type-parameters-arguments/trailing-comma/type-paramters.ts