diff --git a/tests/format/js/comments/__snapshots__/format.test.js.snap b/tests/format/js/comments/__snapshots__/format.test.js.snap index 2eaf4615c..fdac21fab 100644 --- a/tests/format/js/comments/__snapshots__/format.test.js.snap +++ b/tests/format/js/comments/__snapshots__/format.test.js.snap @@ -6202,6 +6202,30 @@ function foo() { ); } +// #4032 +function transitionedFromBleepToBloop() { + return !!( + // Start with a bloop. + thing != null && (thing.foo && thing.foo.bar === 'bloop') && + // End up with a bleep. + (thing.foo && thing.foo.bar === 'bleep') + ); + + return Boolean( + // Start with a bloop. + thing != null && (thing.foo && thing.foo.bar === 'bloop') && + // End up with a bleep. + (thing.foo && thing.foo.bar === 'bleep') + ); + + return foo( + // Start with a bloop. + thing != null && (thing.foo && thing.foo.bar === 'bloop') && + // End up with a bleep. + (thing.foo && thing.foo.bar === 'bleep') + ); +} + =====================================output===================================== function foo() { return ( @@ -6242,6 +6266,39 @@ function foo() { ) } +// #4032 +function transitionedFromBleepToBloop() { + return !!( + // Start with a bloop. + thing != null && + thing.foo && + thing.foo.bar === "bloop" && + // End up with a bleep. + thing.foo && + thing.foo.bar === "bleep" + ) + + return Boolean( + // Start with a bloop. + thing != null && + thing.foo && + thing.foo.bar === "bloop" && + // End up with a bleep. + thing.foo && + thing.foo.bar === "bleep", + ) + + return foo( + // Start with a bloop. + thing != null && + thing.foo && + thing.foo.bar === "bloop" && + // End up with a bleep. + thing.foo && + thing.foo.bar === "bleep", + ) +} + ================================================================================ `; @@ -6288,6 +6345,30 @@ function foo() { ); } +// #4032 +function transitionedFromBleepToBloop() { + return !!( + // Start with a bloop. + thing != null && (thing.foo && thing.foo.bar === 'bloop') && + // End up with a bleep. + (thing.foo && thing.foo.bar === 'bleep') + ); + + return Boolean( + // Start with a bloop. + thing != null && (thing.foo && thing.foo.bar === 'bloop') && + // End up with a bleep. + (thing.foo && thing.foo.bar === 'bleep') + ); + + return foo( + // Start with a bloop. + thing != null && (thing.foo && thing.foo.bar === 'bloop') && + // End up with a bleep. + (thing.foo && thing.foo.bar === 'bleep') + ); +} + =====================================output===================================== function foo() { return ( @@ -6328,6 +6409,39 @@ function foo() { ); } +// #4032 +function transitionedFromBleepToBloop() { + return !!( + // Start with a bloop. + thing != null && + thing.foo && + thing.foo.bar === "bloop" && + // End up with a bleep. + thing.foo && + thing.foo.bar === "bleep" + ); + + return Boolean( + // Start with a bloop. + thing != null && + thing.foo && + thing.foo.bar === "bloop" && + // End up with a bleep. + thing.foo && + thing.foo.bar === "bleep", + ); + + return foo( + // Start with a bloop. + thing != null && + thing.foo && + thing.foo.bar === "bloop" && + // End up with a bleep. + thing.foo && + thing.foo.bar === "bleep", + ); +} + ================================================================================ `; diff --git a/tests/format/js/comments/return-statement-2.js b/tests/format/js/comments/return-statement-2.js index 179d42486..1d2f15ecb 100644 --- a/tests/format/js/comments/return-statement-2.js +++ b/tests/format/js/comments/return-statement-2.js @@ -35,3 +35,27 @@ function foo() { a = b ); } + +// #4032 +function transitionedFromBleepToBloop() { + return !!( + // Start with a bloop. + thing != null && (thing.foo && thing.foo.bar === 'bloop') && + // End up with a bleep. + (thing.foo && thing.foo.bar === 'bleep') + ); + + return Boolean( + // Start with a bloop. + thing != null && (thing.foo && thing.foo.bar === 'bloop') && + // End up with a bleep. + (thing.foo && thing.foo.bar === 'bleep') + ); + + return foo( + // Start with a bloop. + thing != null && (thing.foo && thing.foo.bar === 'bloop') && + // End up with a bleep. + (thing.foo && thing.foo.bar === 'bleep') + ); +}