Skip to content

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

@emont01

Description

@emont01

I am trying to run some tests written in groovy (spockframework) using maven project (pom.xml) but just I discovered that test patterns [only support java]

I am trying to run tests written in Groovy using the Spock framework within a Maven project (with pom.xml) using neotest-java. However, I discovered that the current test file and class pattern matching only supports Java files with .java extensions.

Specifically, the patterns defined here only match Java test files:

local TEST_CLASS_PATTERNS = {
	"Test$",
	"Tests$",
	"Spec$",
	"IT$",
}

local JAVA_TEST_FILE_PATTERNS = {
	"Test%.java$",
	"Tests%.java$",
	"Spec%.java$",
	"IT%.java$",
}

return {
	TEST_CLASS_PATTERNS = TEST_CLASS_PATTERNS,
	JAVA_TEST_FILE_PATTERNS = JAVA_TEST_FILE_PATTERNS,
}

Since Spock tests are written in Groovy files (.groovy), these patterns do not detect them, causing tests not to be found or run.

Suggestion:

Extend the file pattern matching to include .groovy files alongside .java.

Alternatively, consider detecting test files based on their location inside src/test directories, regardless of extension. This enhancement would enable native support for Groovy/Spock tests in Maven projects without requiring extra changes.

I am happy to contribute or help test this feature if needed.

Thank you for considering this improvement!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions