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 Rust group to TEST_PATTERN_GROUPS with tests.rs

thejesh23d6a45371a3d4
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 1279a060..6dbde58b 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
@@ -233,12 +233,19 @@ describe("generateStarterIgnoreFile", () => {
expect(content).toContain("# **/conftest.py");
});
+ it("includes Rust tests.rs per-module extraction convention", () => {
+ const content = generateStarterIgnoreFile(testDir);
+ expect(content).toContain("# Rust");
+ // Rust Book ch. 11.3 pattern — extracted sibling test module.
+ expect(content).toContain("# **/tests.rs");
+ });
+
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", () => {
+ it("emits language groups in stable order: JS, C#, Java, Go, C++, Python, Rust", () => {
const content = generateStarterIgnoreFile(testDir);
const jsIdx = content.indexOf("# JS / TS");
const csIdx = content.indexOf("# C# / .NET");
@@ -246,12 +253,14 @@ describe("generateStarterIgnoreFile", () => {
const goIdx = content.indexOf("# Go");
const cppIdx = content.indexOf("# C++");
const pyIdx = content.indexOf("# Python");
+ const rustIdx = content.indexOf("# Rust");
expect(jsIdx).toBeGreaterThan(-1);
expect(csIdx).toBeGreaterThan(jsIdx);
expect(javaIdx).toBeGreaterThan(csIdx);
expect(goIdx).toBeGreaterThan(javaIdx);
expect(cppIdx).toBeGreaterThan(goIdx);
expect(pyIdx).toBeGreaterThan(cppIdx);
+ expect(rustIdx).toBeGreaterThan(pyIdx);
});
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 e05363fa..c39cc187 100644
--- a/understand-anything-plugin/packages/core/src/ignore-generator.ts
+++ b/understand-anything-plugin/packages/core/src/ignore-generator.ts
@@ -112,6 +112,19 @@ const TEST_PATTERN_GROUPS: Array<{ label: string; patterns: string[] }> = [
"**/conftest.py",
],
},
+ {
+ // Rust's dominant unit-test convention is inline `#[cfg(test)] mod
+ // tests { ... }` blocks that cannot be excluded by filename. The
+ // Rust Book (chapter 11.3) also describes extracting those blocks
+ // into a sibling `tests.rs` file — that extracted form is what a
+ // file-pattern rule can catch. Integration tests already live under
+ // tests/ (covered by EXACT_DIR_NAMES); benches/ was added in the
+ // same PR as this group.
+ label: "Rust",
+ patterns: [
+ "**/tests.rs",
+ ],
+ },
];
/**