@yaegassy/coc-vitest
v0.3.0
Published
Vitest for coc.nvim
Downloads
12
Maintainers
Readme
coc-vitest

Install
CocInstall:
:CocInstall @yaegassy/coc-vitestscoped packages
vim-plug:
Plug 'yaegassy/coc-vitest', {'do': 'yarn install --frozen-lockfile'}Configuration options
vitest.enable: Enable coc-vitest extension, default:truevitest.terminal.enableSplitRight: Use vertical belowright for vitest terminal window, default:falsevitest.codelens.enable: Enable codelens, default:truevitest.codelens.title: CodeLens title. Can be changed to any display, default:">> [Run Vitest]"vitest.watch: Run tests in watch mode, default:false
Commands
:CocCommand [CommandName]
e.g.: :CocCommand vitest.projectTest
vitest.projectTest: Run Vitest for current projectvitest.fileTest: Run Vitest for current filevitest.singleTest: Run Vitest for single (nearest) test
Example of Vim command and key mapping:
Vim commands can be defined and executed or key mappings can be set and used.
" Run Vitest for current project
command! -nargs=0 Vitest :call CocAction('runCommand', 'vitest.projectTest')
" Run Vitest for current file
command! -nargs=0 VitestCurrent :call CocAction('runCommand', 'vitest.fileTest', ['%'])
" Run Vitest for single (nearest) test
nnoremap <leader>te :call CocAction('runCommand', 'vitest.singleTest')<CR>CodeLens (Neovim only)
Feature:
CodeLens appears above the test name in the *.test.ts and *.spec.ts files. Currently, import.meta.vitest is not supported.
coc-settings.json:
By default, codeLens.enable is set to false, which disables it.
Change the setting to true to enable it.
{
"codeLens.enable": true
}Example key mapping (CodeLens related):
nmap <silent> gl <Plug>(coc-codelens-action)Misc:
"CodeLens" does not work with "Vim8" due to coc.nvim specifications.
vitest.singleTest commands are available, so please use them.
Similar coc.nvim extension
Thanks
License
MIT
This extension is built with create-coc-extension
