Skip to content

feat: add Groovy/Spock test file pattern support#266

Open
rcasia wants to merge 4 commits into
mainfrom
feat/groovy-spock-support
Open

feat: add Groovy/Spock test file pattern support#266
rcasia wants to merge 4 commits into
mainfrom
feat/groovy-spock-support

Conversation

@rcasia
Copy link
Copy Markdown
Owner

@rcasia rcasia commented Mar 20, 2026

Summary

Adds support for detecting Groovy/Spock test files in addition to Java test files.

Changes

  • file_checker.lua: Strip .groovy extension alongside .java when checking test patterns
  • patterns.lua: Add GROOVY_TEST_FILE_PATTERNS constant for external use
  • file_checker_spec.lua: Add tests for Groovy/Spock test file detection

How it works

The existing test_classname_patterns (e.g., ^.*Spec$, ^.*Test$) already match Spock test class names. The fix was to ensure the file checker strips .groovy extension before matching against these patterns.

Closes #194

rcasia added 3 commits March 20, 2026 01:44
- Update file_checker to strip .groovy extension alongside .java
- Add GROOVY_TEST_FILE_PATTERNS to patterns module
- Add tests for Groovy/Spock test file detection

Closes #194
- Add maven-groovy fixture with Spock test examples
- Test that Spec and Test files are detected as test files
- Test that main Groovy files are not detected as tests
- Test that directory scan finds Groovy test files
- Test that project root detection works for Groovy projects
- CalculatorSpec.snapshot.json with Spock test methods
- UserServiceTest.snapshot.json with test method
- Update run.lua to handle .groovy extension for snapshots
@rcasia rcasia force-pushed the feat/groovy-spock-support branch 2 times, most recently from cfaf248 to 1aa34ad Compare March 20, 2026 01:06
- Add Maven wrapper files to maven-groovy fixture
- Update run-all.sh to find both Java and Groovy test files
- Update snapshots to match current behavior (empty results)
  - Groovy test method discovery requires Groovy treesitter grammar
@rcasia rcasia force-pushed the feat/groovy-spock-support branch from 1aa34ad to 986db11 Compare March 20, 2026 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE REQUEST] Add support for Groovy/Spock test file patterns in neotest-java

1 participant