From 082e8512df0a511fcbfeb0c3fb552102664bb0b0 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Wed, 21 Jan 2026 09:01:22 +0800 Subject: [PATCH] Add test for #13079 (#18693) --- tests/format/js/if/__snapshots__/format.test.js.snap | 8 ++++++++ tests/format/js/if/if_comments.js | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/tests/format/js/if/__snapshots__/format.test.js.snap b/tests/format/js/if/__snapshots__/format.test.js.snap index 39af73281..ad27d7324 100644 --- a/tests/format/js/if/__snapshots__/format.test.js.snap +++ b/tests/format/js/if/__snapshots__/format.test.js.snap @@ -323,6 +323,10 @@ async function f5() { } } +// https://github.com/prettier/prettier/issues/13079 +if (dotPos > this.pos) /** transition forward */; + else /** transition backward */; + =====================================output===================================== async function f1() { if (untrackedChoice === 0) /* Cancel */ { @@ -375,6 +379,10 @@ async function f5() { } } +// https://github.com/prettier/prettier/issues/13079 +if (dotPos > this.pos) /** transition forward */ ; +else /** transition backward */ ; + ================================================================================ `; diff --git a/tests/format/js/if/if_comments.js b/tests/format/js/if/if_comments.js index bf2a7d61e..87ad29a3d 100644 --- a/tests/format/js/if/if_comments.js +++ b/tests/format/js/if/if_comments.js @@ -53,3 +53,7 @@ async function f5() { /* Allow Untracked */ allowUntracked = true; } } + +// https://github.com/prettier/prettier/issues/13079 +if (dotPos > this.pos) /** transition forward */; + else /** transition backward */;