Is there any way I can debug tests without specifying a mainClass?
This doesn't work :(
```lua
{
type = "kotlin",
request = "launch",
name = "This test file",
mainClass = function()
local root = vim.fs.find("src", { path = vim.uv.cwd(), upward = true, stop = vim.env.HOME })[1] or ""
local fname = vim.api.nvim_buf_get_name(0)
return fname:gsub(root, ""):gsub("test/kotlin/", ""):gsub(".kt", "Kt"):gsub("/", "."):sub(2, -1)
end,
projectRoot = vim.fn.getcwd,
jsonLogFile = "",
enableJsonLogging = false,
}
```
So `mainClass` gives `websearch.SomeTestKt` for `src/test/kotlin/websearch/SomeTest.kt`, `projectRoot` gives the project root with a `build.gradle`, `build/*` and stuff.
But when I run a debug session, it told me `Error: Could not find or load main class websearch.SomeTestKt`, which is to be expected since there is no main class
I have precompiled the project:
```
file build/classes/kotlin/test/websearch/SomeTest.class
build/classes/kotlin/test/websearch/SomeTest.class : compiled Java class data, version 61.0 (
Java SE 17)
```
Is there any way I can debug tests without specifying a
mainClass
?Any help is greatly appreciated!