CocInstall:
:CocInstall @yaegassy/coc-vitest
scoped packages
vim-plug:
Plug 'yaegassy/coc-vitest', {'do': 'yarn install --frozen-lockfile'}
vitest.enable
: Enable coc-vitest extension, default: true
vitest.terminal.enableSplitRight
: Use vertical belowright for vitest terminal window, default: false
vitest.codelens.enable
: Enable codelens, default: true
vitest.codelens.title
: CodeLens title. Can be changed to any display, default: ">> [Run Vitest]"
vitest.watch
: Run tests in watch mode, default: false
: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) testExample 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>
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.
MIT
This extension is built with create-coc-extension