Open ls-devs opened 5 months ago
@ls-devs hey! I was having the same issue and just found a work around that worked for me, hopefully it works for you too.
['neotest-vitest'] = {
vitestCommand = 'npx vitest run',
vitestConfigFile = function(file)
if string.find(file, '/packages/') then
return string.match(file, '(.-/[^/]+/)src') .. 'vitest.config.ts'
end
return vim.fn.getcwd() .. '/vitest.config.ts'
end,
},
Hi, Actually working in a monorepo, I have tests in
my_project/frontend/tests
. If Icd
intomy_project/frontend
tests are found andneotest
is working perfectly. But If I only cd into the root directory of my project, test are not found.I saw this on
vim-test
documentation :Working directory
Test.vim relies on you being cd-ed into the project root. However, sometimes you may want to execute tests from a different directory than Vim's current working directory. You might have a bigger project or monorepo with many subprojects, or you might be using autochdir. In any case, you can tell test.vim to use a different working directory for running tests:
Unfortunately, if I set
test#project_root
tomy_project/frontent
ormy_project/frontend/tests
and onlycd
into the root directory of my project (my_project/
). Tests aren't found.How can I make
vim-test
/neotest-vim-test
found my tests folder without alwayscd
in the direct parent folder of my tests ? (heremy_project/frontend
)EDIT : Found a workaround using
But shouldn't
let test#project_root = "/path/to/your/project"
do the job ?