Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ impl PreferDescribeFunctionTitle {
return;
}

let Some(test_vitest_fn) = parse_general_jest_fn_call(call_expr, possible_jest_node, ctx)
else {
return;
};

if test_vitest_fn.kind != JestFnKind::General(JestGeneralFnKind::Describe) {
return;
}

let mut imported_entries =
ctx.module_record().import_entries.iter().map(|entry| entry.local_name.name.as_ref());

Expand Down Expand Up @@ -113,16 +122,6 @@ impl PreferDescribeFunctionTitle {
);
}
Argument::StringLiteral(string_title) => {
let Some(test_vitest_fn) =
parse_general_jest_fn_call(call_expr, possible_jest_node, ctx)
else {
return;
};

if test_vitest_fn.kind != JestFnKind::General(JestGeneralFnKind::Describe) {
return;
}

if !imported_entries.contains(string_title.value.as_ref()) {
return;
}
Expand Down Expand Up @@ -263,6 +262,32 @@ fn test() {
Some(serde_json::json!({ "settings": { "vitest": { "typecheck": true, }, } })),
Some(PathBuf::from("myFunction.test.ts")),
),
(
r#"
import { DocumentBuilder } from "./DocumentBuilder"
describe("Swagger Helper", () => {
beforeEach(() => {
vi.spyOn(DocumentBuilder.prototype, "setTitle")
})
})
Comment on lines +267 to +272
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation in this test case uses mixed tabs and spaces. The raw string literal should use consistent indentation (tabs based on the pattern in other test cases in this file).

Copilot uses AI. Check for mistakes.
"#,
None,
None,
Some(PathBuf::from("swagger.helpers.spec.ts")),
),
(
r#"
import { myFunction } from "./myFunction"
describe("Test Suite", () => {
beforeEach(() => {
vi.spyOn(myFunction, "name")
})
})
Comment on lines +280 to +285
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation in this test case uses mixed tabs and spaces. The raw string literal should use consistent indentation (tabs based on the pattern in other test cases in this file).

Copilot uses AI. Check for mistakes.
"#,
None,
None,
Some(PathBuf::from("myFunction.test.ts")),
),
];

let fail = vec![
Expand Down
Loading