Is it possible to run a task before running a neotest run? #92
-
Wondering if it's possible with the current plugin version to run a task (e.g builds the project) and only then run the neotest action? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Should be! There's a component for specifying dependencies for a task, so all you need to do is attach that to your neotest task. There's two ways to do this:
require("overseer").setup({
component_aliases = {
default_neotest = {
{ "dependencies", task_names = {
{ "shell", cmd = "sleep 4" },
} },
"default",
},
},
})
require("neotest").setup({
strategies = {
overseer = {
components = {
{ "dependencies", task_names = {
{ "shell", cmd = "sleep 4" },
} },
"default_neotest",
},
},
},
}) For this second option, you can also define the components as a function, so you can choose at runtime whether to add this dependency or not require("neotest").setup({
strategies = {
overseer = {
components = function(run_spec)
return {
{ "dependencies", task_names = {
{ "shell", cmd = "sleep 4" },
} },
"default_neotest",
}
end,
},
},
}) Note that for these last two I pushed up a couple of changes just now, so you'll need to fetch the latest master. |
Beta Was this translation helpful? Give feedback.
Should be! There's a component for specifying dependencies for a task, so all you need to do is attach that to your neotest task. There's two ways to do this:
default_neotest
component aliasFor this second option, y…