Skip to content

Graphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.

feat(core): add Swift group to TEST_PATTERN_GROUPS with XCTest patterns

thejesh2391d869044697
diff --git a/understand-anything-plugin/packages/core/src/__tests__/ignore-generator.test.ts b/understand-anything-plugin/packages/core/src/__tests__/ignore-generator.test.ts
index 5ee941ae..ad462bb0 100644
--- a/understand-anything-plugin/packages/core/src/__tests__/ignore-generator.test.ts
+++ b/understand-anything-plugin/packages/core/src/__tests__/ignore-generator.test.ts
@@ -284,12 +284,21 @@ describe("generateStarterIgnoreFile", () => {
expect(content).toContain("# **/rails_helper.rb");
});
+ it("includes Swift XCTest / Swift Testing file patterns", () => {
+ const content = generateStarterIgnoreFile(testDir);
+ expect(content).toContain("# Swift");
+ // Dominant Apple convention — one <ClassName>Tests.swift per unit.
+ expect(content).toContain("# **/*Tests.swift");
+ // Singular variant seen in some older codebases.
+ expect(content).toContain("# **/*Test.swift");
+ });
+
it("groups patterns under the JS / TS sub-header", () => {
const content = generateStarterIgnoreFile(testDir);
expect(content).toContain("# JS / TS");
});
- it("emits language groups in stable order: JS, C#, Java, Go, C++, Python, Rust, Ruby", () => {
+ it("emits language groups in stable order: JS, C#, Java, Go, C++, Python, Rust, Ruby, Swift", () => {
const content = generateStarterIgnoreFile(testDir);
const jsIdx = content.indexOf("# JS / TS");
const csIdx = content.indexOf("# C# / .NET");
@@ -299,6 +308,7 @@ describe("generateStarterIgnoreFile", () => {
const pyIdx = content.indexOf("# Python");
const rustIdx = content.indexOf("# Rust");
const rubyIdx = content.indexOf("# Ruby");
+ const swiftIdx = content.indexOf("# Swift");
expect(jsIdx).toBeGreaterThan(-1);
expect(csIdx).toBeGreaterThan(jsIdx);
expect(javaIdx).toBeGreaterThan(csIdx);
@@ -307,6 +317,7 @@ describe("generateStarterIgnoreFile", () => {
expect(pyIdx).toBeGreaterThan(cppIdx);
expect(rustIdx).toBeGreaterThan(pyIdx);
expect(rubyIdx).toBeGreaterThan(rustIdx);
+ expect(swiftIdx).toBeGreaterThan(rubyIdx);
});
it("keeps all suggestions commented even with no detected dirs and no .gitignore", () => {
diff --git a/understand-anything-plugin/packages/core/src/ignore-generator.ts b/understand-anything-plugin/packages/core/src/ignore-generator.ts
index 8d2769fc..412c7cc4 100644
--- a/understand-anything-plugin/packages/core/src/ignore-generator.ts
+++ b/understand-anything-plugin/packages/core/src/ignore-generator.ts
@@ -156,6 +156,19 @@ const TEST_PATTERN_GROUPS: Array<{ label: string; patterns: string[] }> = [
"**/rails_helper.rb",
],
},
+ {
+ // Apple's XCTest and the newer Swift Testing framework both use a
+ // dominant `<ClassName>Tests.swift` naming convention. SPM's `Tests/`
+ // package directory is already caught by the case-insensitive `tests`
+ // dir rule, but individual test files sometimes leak elsewhere
+ // (Xcode-style `<AppName>Tests/` folders that use no leading dot,
+ // fixture-adjacent extension test files under Sources/).
+ label: "Swift",
+ patterns: [
+ "**/*Tests.swift",
+ "**/*Test.swift",
+ ],
+ },
];
/**