Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion crates/oxc_formatter/src/write/call_arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,17 @@ impl<'a> Format<'a> for AstNode<'a, ArenaVec<'a, Argument<'a>>> {

if is_simple_module_import
|| call_expression.is_some_and(|call| {
is_commonjs_or_amd_call(self, call, f) || is_test_call_expression(call)
is_commonjs_or_amd_call(self, call, f)
|| ((self.len() != 2
|| matches!(
arguments.first(),
Some(
Argument::StringLiteral(_)
| Argument::TemplateLiteral(_)
| Argument::TaggedTemplateExpression(_)
)
))
&& is_test_call_expression(call))
})
|| is_multiline_template_only_args(self, f.source_text())
|| is_react_hook_with_deps_array(self, f.comments())
Expand Down
4 changes: 3 additions & 1 deletion crates/oxc_formatter/tests/fixtures/js/calls/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ test.describe.only("Describe only", () => {});
// These simpler patterns should still work
test.only("Test only", () => {});
describe.only("Describe only", () => {});
it.only("It only", () => {});
it.only("It only", () => {});

test(code.replace((c) => ""), () => {});
7 changes: 7 additions & 0 deletions crates/oxc_formatter/tests/fixtures/js/calls/test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ test.describe.only("Describe only", () => {});
test.only("Test only", () => {});
describe.only("Describe only", () => {});
it.only("It only", () => {});

test(code.replace((c) => ""), () => {});
==================== Output ====================
// Test patterns with multiple levels should not break incorrectly
test.describe.serial("My test suite", () => {
Expand All @@ -50,4 +52,9 @@ test.only("Test only", () => {});
describe.only("Describe only", () => {});
it.only("It only", () => {});

test(
code.replace((c) => ""),
() => {},
);

===================== End =====================
Loading